Tutorials to .com

Tutorials to .com » Jsp » Database » JAVA database connectivity issues do not have set up a data source

JAVA database connectivity issues do not have set up a data source

Print View , by: iSee ,Total views: 19 ,Word Count: 280 ,Date: Sat, 18 Apr 2009 Time: 8:07 PM

I read this section of code::

<% Class.forName ( "com.microsoft.jdbc.sqlserver.SQLServerDriver"). NewInstance ();

String url = "jdbc: microsoft: sqlserver: / / localhost: 1433; DatabaseName = shop"; / / database name

String user = "sa";

String password = "sa";

Connection conn = DriverManager.getConnection (url, user, password);

Statement stmt = conn.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);

String sql = "select * from userinfo";

ResultSet rs = stmt.executeQuery (sql);

while (rs.next ())

(%> Your first column says: <% = rs.getString (2)%>

The second field of your content: <% = rs.getString (3)%>

<%}%>

<% Out.print ( "database operations successful, congratulate you ");%>

<% Rs.close ();

stmt.close ();

conn.close ();

%>
I copy down the database after the modification, and to amend the table name, but under the browsing TOMCAT error;
I am learning JSP, advice please click! ! I think it is not loaded com.microsoft.jdbc.sqlserver.SQLServerDriver drive it? ?


Jsp And Database Articles


Can't Find What You're Looking For?


Rating: Not yet rated

Comments

No comments posted.