Java开发网 |
注册 |
登录 |
帮助 |
搜索 |
排行榜 |
发帖统计
|
您没有登录 |
» Java开发网 » Database/JDBC/SQL/JDO/Hibernate
打印话题 寄给朋友 订阅主题 |
作者 | Re:JDBC链接SQL SERVER2000的问题?脑爆了!! [Re:蓝眼龙] |
yingzhe
发贴: 6 积分: 0 |
于 2005-11-16 13:17
同问,我郁闷两天了 装完jdk,tomcat,配置后,运行正常 下载安装jdbc for sqlserver,msbase.jar,mssqlserver.jar,msutil.jar拷贝到Tomcat目录下common\lib目录下,之后,修改环境变量中的CLASSPATH, 把SQL Server 2000 For JDBC 驱动程序安装目录下的 C:\Program Files\Microsoft SQL Server 2000 Driver for JDBC\lib\msbase.jar;C:\Program Files\Microsoft SQL Server 2000 Driver for JDBC\lib\mssqlserver.jar; C:\Program Files\Microsoft SQL Server 2000 Driver for JDBC\lib\msutil.jar;追加到CLASSPATH中去 测试连接数据库的程序如下 <%@ page contentType="text/html;charset=gb2312"%> <%@ page import="java.lang.*, java.io.*, java.sql.*, java.util.*"%> <html> <body> <% Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance(); String url="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=netclass"; //我在数据库中新建了一个netclass数据库 //sa的密码是:123 Connection conn=DriverManager.getConnection(url,"sa","123"); Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE); String sql="select * from Student"; //netclass中有个Student表 ResultSet rs=stmt.executeQuery(sql); while(rs.next()) {%> 您的第一个字段内容为:<%=rs.getString(1)%> 您的第二个字段内容为:<%=rs.getString(2)%> <%}%> <%out.print("数据库操作成功,恭喜你");%> <%rs.close(); stmt.close(); conn.close(); %> </body> </html> 错误提示: 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: [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket. 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.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:512) java.sql.DriverManager.getConnection(DriverManager.java:171) org.apache.jsp.netclass.test_jsp._jspService(test_jsp.java:53) 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) 两天了,一直都没有解决这个问题 不知道楼主是怎么解决的 焦急等待中ing....... 酒后论天下英雄,叹无伯乐识君;更难堪,红颜无福,竟入他人怀! 关于女孩子从事软件开发的问题 |
话题树型展开 |
人气 | 标题 | 作者 | 字数 | 发贴时间 |
10802 | JDBC链接SQL SERVER2000的问题?脑爆了!! | 蓝眼龙 | 2324 | 2005-11-05 19:54 |
8937 | Re:JDBC链接SQL SERVER2000的问题?脑爆了!! | why | 71 | 2005-11-06 04:48 |
9011 | Re:JDBC链接SQL SERVER2000的问题?脑爆了!! | 蓝眼龙 | 56 | 2005-11-07 09:04 |
8974 | Re:JDBC链接SQL SERVER2000的问题?脑爆了!! | dlq | 21 | 2005-11-07 23:15 |
8952 | Re:JDBC链接SQL SERVER2000的问题?脑爆了!! | q_yuan | 22 | 2005-11-15 11:33 |
8793 | Re:JDBC链接SQL SERVER2000的问题?脑爆了!! | why | 132 | 2005-11-15 18:43 |
9085 | Re:JDBC链接SQL SERVER2000的问题?脑爆了!! | yingzhe | 3620 | 2005-11-16 13:17 |
9037 | Re:JDBC链接SQL SERVER2000的问题?脑爆了!! | yingzhe | 525 | 2005-11-16 13:28 |
11165 | Re:JDBC链接SQL SERVER2000的问题?脑爆了!! | 迸泉 | 110 | 2005-11-20 17:36 |
已读帖子 新的帖子 被删除的帖子 |
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 |