Topic: 为什么我的jsp跟SQLServer总连接不上啊! |
Print this page |
1.为什么我的jsp跟SQLServer总连接不上啊! | Copy to clipboard |
Posted by: 孤独王子 Posted on: 2005-11-24 15:45 CLASS_PATH .;%JAVA_HOME%\lib\tools.jar;%JAVA_HOME%\lib\dt.jar;D:\java\connToSqlLib\msbase.jar;D:\Java\connToSqlLib\mssqlserver.jar;D:\Java\connToSqlLib\msutil.jar;%CATALINA_HOME%\common\lib\servlet-api.jar java_home D:\java\jdk1.5.0_03 catalina_home D:\java\Tomcat5 jsp文件: <%@ page import="java.lang.*, java.io.*, java.sql.*, java.util.*" contentType="text/html;charset=gb2312" %> <html> <body> <% Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance(); String url="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=tt"; String user="sa"; String password="sasa"; Connection conn= DriverManager.getConnection(url,user,password); Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE); String sql="select * from mql"; ResultSet rs=stmt.executeQuery(sql); while(rs.next()) { %> 您的第一个字段内容为:<%=rs.getString(1)%><br> 您的第二个字段内容为:<%=rs.getString(2)%><br> <% } %> <% out.print("数据库操作成功,恭喜你"); %> <% rs.close(); stmt.close(); conn.close(); %> </body> </html> SQLSERVER2000 : 存在tt数据库,里面存在mql表,表中有2个字段,并且都有值! 运行时候出错: 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: Unable to load class for JSP org.apache.jasper.JspCompilationContext.load(JspCompilationContext.java:598) org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:137) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:305) 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.ClassNotFoundException: org.apache.jsp.test_jsp java.net.URLClassLoader$1.run(URLClassLoader.java:200) java.security.AccessController.doPrivileged(Native Method) java.net.URLClassLoader.findClass(URLClassLoader.java:188) org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:133) org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:65) org.apache.jasper.JspCompilationContext.load(JspCompilationContext.java:596) org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:137) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:305) 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.12 logs. -------------------------------------------------------------------------------- Apache Tomcat/5.5.12 |
2.Re:为什么我的jsp跟SQLServer总连接不上啊! [Re: 孤独王子] | Copy to clipboard |
Posted by: 孤独王子 Posted on: 2005-11-24 15:53 版本: SqlServer 2000 (没打补丁) jdbc for SQLServer2000 sp3 |
3.Re:为什么我的jsp跟SQLServer总连接不上啊! [Re: 孤独王子] | Copy to clipboard |
Posted by: 孤独王子 Posted on: 2005-11-24 15:54 操作系统是 win2000 professional , SQLServer sp4的补丁我装不上 提示信息 :“不支持目标语言的升级“ |
4.Re:为什么我的jsp跟SQLServer总连接不上啊! [Re: 孤独王子] | Copy to clipboard |
Posted by: asdyx Posted on: 2005-11-24 16:06 现在编译都没通过啊 |
5.Re:为什么我的jsp跟SQLServer总连接不上啊! [Re: 孤独王子] | Copy to clipboard |
Posted by: 孤独王子 Posted on: 2005-11-24 16:18 是什么的问题,我没连接锅SQL ,净用ora来着 |
6.Re:为什么我的jsp跟SQLServer总连接不上啊! [Re: 孤独王子] | Copy to clipboard |
Posted by: yingzhe Posted on: 2005-11-27 17:05 同问: 我的测试程序跟上面几乎一样(除了数据库和表的名称,sa 的密码) 也总是链接不上,郁闷几天了 错误信息如下: HTTP Status 500 - -------------------------------------------------------------------------------- type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception 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.netclass.test_jsp._jspService(test_jsp.java:87) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) root cause java.lang.ClassNotFoundException: com.microsoft.jdbc.sqlserver.SQLServerDriver org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1340) org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1189) org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:150) org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:71) java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) java.lang.Class.forName0(Native Method) java.lang.Class.forName(Class.java:164) org.apache.jsp.netclass.test_jsp._jspService(test_jsp.java:51) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) |
7.Re:为什么我的jsp跟SQLServer总连接不上啊! [Re: yingzhe] | Copy to clipboard |
Posted by: YuLimin Posted on: 2005-11-27 17:28 1、下载Microsoft SQL Server 2000 Service Pack 3a并安装,SQL请选用混和安装模式!!! http://www.microsoft.com/downloads/details.aspx?FamilyId=90DCD52C-0488-4E46-AFBF-ACACE5369FA3&displaylang=zh-cn 2、下载SQL Server 2000 Driver for JDBC Service Pack 3 http://www.microsoft.com/downloads/details.aspx?FamilyId=07287B11-0502-461A-B138-2AA54BFDC03A&displaylang=en 3、运行时关闭防火墙 |
8.Re:为什么我的jsp跟SQLServer总连接不上啊! [Re: 孤独王子] | Copy to clipboard |
Posted by: why Posted on: 2005-11-27 18:52 孤独王子 wrote: Try SP3a, as YuLimin suggested. If possible, forget about M$'s JDBC driver and use jTDS. yingzhe wrote: Read the error message: javax.servlet.ServletException: com.microsoft.jdbc.sqlserver.SQLServerDriver Put the lib jars in the proper location, i.e. TOMCAT_HOME/common/lib or PROJECT/WEB-INF/lib |
9.Re:为什么我的jsp跟SQLServer总连接不上啊! [Re: 孤独王子] | Copy to clipboard |
Posted by: wzl0917 Posted on: 2005-11-29 17:14 SP3a应该可以 只是SP4不知道和SP3a有什么区别? |
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 |