Dear, I have not been happy.
Just started learning JSP and configured the environment, JDBC was also installed. So I want to try a link database
//1.jsp (put it in the root directory of Tomcat 5.0)
<% @ Page ContentType = "Text / HTML; Charset = GB2312"%> <% @ page import = "java.sql. *"%>
<% class.Forname ("com.microsoft.jdbc .sqlserver.sqlserdriver "). newinstance (); string url =" JDBC: Microsoft: SQLServer: // localhost: 1433; databasename = pubs "; // Pubs for your database String user =" sa "; string password = ""; Connection conn = DriverManager.getConnection (url, user, password); Statement stmt = conn.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); String sql = "select * from test"; ResultSet rs = stmt.executeQuery ( SQL); while (rs.next ()) {%> Your first field content is: <% = rs.getstring (1)%> Your second field content is: <% = rs.getstring 2)%> <%}%> <% out.print ("Database operation is successful, congratulations");%> <% rs.close (); stmt.close (); conn.close ();%> < / Body> html>The above code is running at http://127.0.0.1:8080/1.jsp, but an error
Java.sql.sqlexception: [Microsoft] [SQLSERVER JDBC DRIVER] [SQLServer] User 'SA' Login failed. Cause: Not associated with trusted SQL Server connections.
So I was a JSP group found someone to help, but it can run success in its machine.
I think it may be that JDBC is not well installed, and it is called the three files to me, add it to tomcat5.0 / common / lib, run again, or report this wrong, now it is helpless, ask for people help.