JSP 连接 Sql Server 2005 出错,请高手帮忙!
HTTP Status 500 -type Exception report
message
description
The server encountered an internal error () that prevented it from fulfilling this request.exception
org.apache.jasper.JasperException: An exception occurred processing JSP page /database/sql.jsp at line 10
7: ResultSet rs = null;
8: Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
9: String url="jdbc:sqlserver://localhost;integratedSecurity=true;DatabaseName=student";
10: conn=DriverManager.getConnection(url);
11: String sql="select * from Student";
12: stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
13: rs=stmt.executeQuery(sql);
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handle
JspException(JspServletWrapper.java:568)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:455)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
root cause
javax.servlet.ServletException:
java.sql.SQLException: [Microsoft][
SQLServer 2000 Driver for JDBC][SQLServer]用户 '' 登录失败。该用户与可信 SQL Server 连接无关联。
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:911)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:840)
org.apache.jsp.database.sql_jsp._jspService(sql_jsp.java:108)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
------解决方案--------------------你登录数据库难道不用账号和密码么
只有一个url不能连接数据库诶、
10: conn=DriverManager.getConnection(url,username,passsword);
------解决方案--------------------你的username和password呢?
10: conn=DriverManager.getConnection(url,username,passsword);
------解决方案--------------------conn=DriverManager.getConnection(url,username,passsword);
------解决方案--------------------把你连接sql server的代码贴出看看,就知道拉。
------解决方案--------------------你的sql jdbc是放在哪里?
------解决方案--------------------
------解决方案--------------------
------解决方案--------------------