Java开发网 |
注册 |
登录 |
帮助 |
搜索 |
排行榜 |
发帖统计
|
您没有登录 |
» Java开发网 » Database/JDBC/SQL/JDO/Hibernate
打印话题 寄给朋友 订阅主题 |
作者 | 请求高手解决一个JDBC连接的问题。 |
jin3shan
发贴: 33 积分: 0 |
于 2006-05-19 14:27
错误信息如下: type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception org.apache.jasper.JasperException: Exception in JSP: /testMssql.jsp:25 22: %> 23: <% 24: 25: Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance(); 26: Connection con=java.sql.DriverManager.getConnection("jdbc:microsoft:sqlserver://127.0.0.1:1433;DatabaseName=jspdev","",""); 27: Statement stmt=con.createStatement(); 28: ResultSet rst=stmt.executeQuery("select * from book;"); Stacktrace: org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:504) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) root cause javax.servlet.ServletException: com/microsoft/jdbc/base/BaseDriver org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:858) org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791) org.apache.jsp.testMssql_jsp._jspService(testMssql_jsp.java:99) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) root cause java.lang.NoClassDefFoundError: com/microsoft/jdbc/base/BaseDriver java.lang.ClassLoader.defineClass1(Native Method) java.lang.ClassLoader.defineClass(ClassLoader.java:620) java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) java.net.URLClassLoader.defineClass(URLClassLoader.java:260) java.net.URLClassLoader.access$100(URLClassLoader.java:56) java.net.URLClassLoader$1.run(URLClassLoader.java:195) java.security.AccessController.doPrivileged(Native Method) java.net.URLClassLoader.findClass(URLClassLoader.java:188) java.lang.ClassLoader.loadClass(ClassLoader.java:306) java.lang.ClassLoader.loadClass(ClassLoader.java:299) java.lang.ClassLoader.loadClass(ClassLoader.java:251) org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1339) org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1198) org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:127) org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:65) java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) java.lang.Class.forName0(Native Method) java.lang.Class.forName(Class.java:164) org.apache.jsp.testMssql_jsp._jspService(testMssql_jsp.java:70) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) note The full stack trace of the root cause is available in the Apache Tomcat/5.5.16 logs. 请问一下是哪个地方的错误,是JDBC配置错误,还是代码错误。 JAVA学习日子分享 |
作者 | Re:请求高手解决一个JDBC连接的问题。 [Re:jin3shan] |
why
問題兒童 总版主 发贴: 4629 积分: 388 |
于 2006-05-20 11:07
> java.lang.NoClassDefFoundError: com/microsoft/jdbc/base/BaseDriver Please put the M$ jar in the appropiate location: <Tomcat>/common/lib (%CATALINA_HOME%\common\lib) or <Webapp>/lib Java应用者与<IDE/环境> |
作者 | Re:请求高手解决一个JDBC连接的问题。 [Re:jin3shan] |
jin3shan
发贴: 33 积分: 0 |
于 2006-05-20 12:47
谢谢你的回答!但是,我装好了jar,并设置了CLASSPATH,还是会出现同样的错误.请问是为什么呢.我的JDK版本为jdk-1_5_0_06-windows-i586-p.exe;tomcat版本为apache-tomcat-5.5.17.exe 数据库Mssql server2000我的设置如下: JAVA_HOME: D:\jdk1.5 CATALINA_HOME: D:\Tomcat 5.5 CLASSPATH: .;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar;%CATALINA_HOME%\common\lib\msbase.jar;%CATALINA_HOME%\common\lib\mssqlserver.jar;%CATALINA_HOME%\common\lib\msutil.jar Path: %JAVA_HOME%\D:\jdk1.5\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\Microsoft SQL Server\80\Tools\BINN 程序代码如下:
请再帮我看看.
why edited on 2006-05-21 21:56
菜鸟请教,基本程序调试不通,急急急急急急!!! |
作者 | Re:请求高手解决一个JDBC连接的问题。 [Re:jin3shan] |
jin3shan
发贴: 33 积分: 0 |
于 2006-05-20 13:15
type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception org.apache.jasper.JasperException: Exception in JSP: /testMssql.jsp:26 23: <% 24: 25: Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance(); 26: Connection con=java.sql.DriverManager.getConnection("jdbc:microsoft:sqlserver://127.0.0.1:1433;DatabaseName=jspdev","sa","sa"); 27: Statement stmt=con.createStatement(); 28: ResultSet rst=stmt.executeQuery("select * from book;"); 29: while(rst.next()) Stacktrace: org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:504) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) root cause javax.servlet.ServletException: [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket. org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:858) org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791) org.apache.jsp.testMssql_jsp._jspService(testMssql_jsp.java:99) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) root cause java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket. com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source) com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source) com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source) com.microsoft.jdbc.sqlserver.tds.TDSConnection.<init>(Unknown Source) com.microsoft.jdbc.sqlserver.SQLServerImplConnection.open(Unknown Source) com.microsoft.jdbc.base.BaseConnection.getNewImplConnection(Unknown Source) com.microsoft.jdbc.base.BaseConnection.open(Unknown Source) com.microsoft.jdbc.base.BaseDriver.connect(Unknown Source) java.sql.DriverManager.getConnection(DriverManager.java:525) java.sql.DriverManager.getConnection(DriverManager.java:171) org.apache.jsp.testMssql_jsp._jspService(testMssql_jsp.java:71) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) note The full stack trace of the root cause is available in the Apache Tomcat/5.5.17 logs. 这又是什么错误. 25了才开始学JAVA晚吗? |
作者 | Re:请求高手解决一个JDBC连接的问题。 [Re:jin3shan] |
why
問題兒童 总版主 发贴: 4629 积分: 388 |
于 2006-05-21 22:03
jin3shan wrote: 1. Tomcat may not use the CLASSPATH -- I am not sure about this. 2. I won't use folder names with spaces for my Java projects. 3. %JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar are not really necessary > 还是会出现同样的错误 Did you restart Tomcat? Is it really the same error?? In the next post, you wrote: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket > Error establishing socket Please do a seach on this board first. There are many many many topics about this, including the topmost one. Please let us know whether you could solve the problem and how.
why edited on 2006-05-21 22:09
25了才开始学JAVA晚吗? |
作者 | Re:请求高手解决一个JDBC连接的问题。 [Re:jin3shan] |
jin3shan
发贴: 33 积分: 0 |
于 2006-05-22 08:44
是不是还需要配置web-inf/xml. Hibernate开发指南 |
作者 | Re:请求高手解决一个JDBC连接的问题。 [Re:jin3shan] |
jin3shan
发贴: 33 积分: 0 |
于 2006-05-22 09:32
没设置web-in/xml.错误信息又成了这样. 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: Exception in JSP: /testMssql.jsp:26 23: <% 24: 25: Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance(); 26: Connection con=java.sql.DriverManager.getConnection("jdbc:microsoft:sqlserver:127.0.0.1:1433;DatabaseName=jspdev","sa","sa"); 27: Statement stmt=con.createStatement(); 28: ResultSet rst=stmt.executeQuery("select * from book;"); 29: while(rst.next()) Stacktrace: org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:504) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) root cause javax.servlet.ServletException: [Microsoft][SQLServer 2000 Driver for JDBC]Unable to connect. Invalid URL. org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:858) org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791) org.apache.jsp.testMssql_jsp._jspService(testMssql_jsp.java:99) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) root cause java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Unable to connect. Invalid URL. com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source) com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source) com.microsoft.jdbc.base.BaseDriver.connect(Unknown Source) java.sql.DriverManager.getConnection(DriverManager.java:525) java.sql.DriverManager.getConnection(DriverManager.java:171) org.apache.jsp.testMssql_jsp._jspService(testMssql_jsp.java:71) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) note The full stack trace of the root cause is available in the Apache Tomcat/5.5.17 logs. 请问下是怎么回事呢?又该怎么解决呢. 我有一点感想和初学者们同享(原创) |
作者 | Re:请求高手解决一个JDBC连接的问题。 [Re:jin3shan] |
why
問題兒童 总版主 发贴: 4629 积分: 388 |
于 2006-05-22 12:41
jin3shan wrote: In your case, I don't think so. > 没设置web-in/xml.错误信息又成了这样. What are you talking about? > Error establishing socket READ the topmost topic on this board, i.e. [database] JDBC with M$ SQL Server (including Error establishing socket) 25了才开始学JAVA晚吗? |
作者 | Re:请求高手解决一个JDBC连接的问题。 [Re:jin3shan] |
CRYSPARK
发贴: 1 积分: 0 |
于 2006-06-22 11:55
这个问题吗 mssql的驱动一共有3个你都放进去了吗? 我有一点感想和初学者们同享(原创) |
已读帖子 新的帖子 被删除的帖子 |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |