当前位置: 代码迷 >> Java Web开发 >> jsp连接sql2000 出了什么有关问题
  详细解决方案

jsp连接sql2000 出了什么有关问题

热度:123   发布时间:2016-04-17 13:29:14.0
jsp连接sql2000 出了什么问题
org.apache.jasper.JasperException:   Exception   in   JSP:   /testsqlserver.jsp:11

8:   <title> Insert   title   here </title>
9:   </head>
10:   <body>
11:   <%Class.forName( "com.microsoft.jdbc.sqlserver.SQLServerDriver ").newInstance();  
12:   String   url= "jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=Student ";  
13:   //pubs为你的数据库的  
14:   String   user= "sa ";  


Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:467)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:371)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)


root   cause  

javax.servlet.ServletException:   com.microsoft.jdbc.sqlserver.SQLServerDriver
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:846)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:779)
org.apache.jsp.testsqlserver_jsp._jspService(testsqlserver_jsp.java:89)
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:328)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
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:1359)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1205)
org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:128)
org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:66)
java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
java.lang.Class.forName0(Native   Method)
java.lang.Class.forName(Class.java:164)
org.apache.jsp.testsqlserver_jsp._jspService(testsqlserver_jsp.java:52)
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:328)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)


note   The   full   stack   trace   of   the   root   cause   is   available   in   the   Apache   Tomcat/5.5.23   logs.



------解决方案--------------------
看testsqlserver_jsp.java文件52行和89行,看看显示的是什么?
------解决方案--------------------
楼主用的是什么系统呢?如果是在XP下连SQL最低是需要SQL SP3的补丁包的,你的SQL有没有打补丁包啊?
------解决方案--------------------
java.lang.ClassNotFoundException: com.microsoft.jdbc.sqlserver.SQLServerDriver

是不是缺少了某个所需要的包 文件
没有导入支持 sqlserverdriver的包文件
------解决方案--------------------
1,下载比较新点的jdbc driver
http://www.microsoft.com/downloads/details.aspx?familyid=6d483869-816a-44cb-9787-a866235efc7c&displaylang=en
  相关解决方案