jsp和sql server数据库连接问题
操作系统是winxpsp2,数据库是sql server2000个人版升级到sp4,jdbc是Microsoft SQL Server 2005 JDBC Driver\sqljdbc_1.1,jdk是jdk1.6.0.
Microsoft SQL Server 2005 JDBC Driver安装在C:\Program Files\Microsoft SQL Server 2005 JDBC Driver下.classpath=C:\Program Files\Microsoft SQL Server 2005 JDBC Driver\sqljdbc_1.1\enu\jdbc.jar;
运行testsqlserver.jsp出现以下错误:
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: javax.servlet.ServletException: java.lang.ClassNotFoundException: com.microsoft.jdbc.sqlserver.SQLServerDriver
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:565)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:414)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
root cause
javax.servlet.ServletException: java.lang.ClassNotFoundException: com.microsoft.jdbc.sqlserver.SQLServerDriver
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:855)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:784)
org.apache.jsp.testsqlserver_jsp._jspService(testsqlserver_jsp.java:98)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:390)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
root cause
java.lang.ClassNotFoundException: com.microsoft.jdbc.sqlserver.SQLServerDriver
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1358)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)
org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:128)
org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:66)
java.lang.ClassLoader.loadClassInternal(Unknown Source)
java.lang.Class.forName0(Native Method)
java.lang.Class.forName(Unknown Source)
org.apache.jsp.testsqlserver_jsp._jspService(testsqlserver_jsp.java:58)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:390)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.7 logs.
[解决办法]
java.lang.ClassNotFoundException: com.microsoft.jdbc.sqlserver.SQLServerDriver
没有对应的驱动类
去下载对应的驱动类
[解决办法]
把驱动的包配置到WEB-INF/lib下了吗?
[解决办法]
差少驱动包
[解决办法]
msbase.jar mssqlserver.jar msutil.jar
这3个JAR包要放在WEB-INF/lib目录下
[解决办法]
SQL Server 2000
msbase.jar mssqlserver.jar msutil.jar
必须在WEB-INF/lib目录下
SQL Server2005
sqljdbc.jar
必须在WEB-INF/lib目录下
我的异常网推荐解决方案:The server encountered an internal error () that prevented it from fulfilling this request.,http://www.myexception.cn/java-web/317.html