Topic: JSP连接SQL server 2000的问题,先谢谢啦 |
Print this page |
1.JSP连接SQL server 2000的问题,先谢谢啦 | Copy to clipboard |
Posted by: jmszcy01061 Posted on: 2005-04-09 11:56 有一个JSP连接SQL server 2000的问题向您请教一下 源代码如下: <%@ page contentType="text/html;charset=GB2312"%> <%@ page import="java.sql.*"%> <html> <body> <%try{ Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance(); } catch(ClassNotFoundException e) { out.println(e.getMessage()); } String url= "jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=pubs"; Connection conn=DriverManager.getConnection(url,"sa",""); Statement stmt=conn.createStatement(); String sql = "select * from jobs"; ResultSet rs=stmt.executeQuery(sql); while(rs.next()) {%> <%=rs.getString(1)%><br> <%=rs.getString(2)%><br> <%=rs.getString(3)%><br> <%}%> <% rs.close(); stmt.close(); conn.close(); %> </body> </html> 以前还可以连接上,自从重新装了操作系统,就连不上 jsp运行环境我已经设置好了,我用JDBC-ODBC连接桥可以连接sql server,但是通过装载指定的JDBC驱动就连不上, 执行下面两句时,就会发生错误 String url= "jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=pubs"; Connection conn=DriverManager.getConnection(url,"sa",""); 错误信息是: Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket 1433是Tcp/Ip指定端口,是不是这方面有问题? 请问这个错误如何处理 |
2.Re:JSP连接SQL server 2000的问题,先谢谢啦 [Re: jmszcy01061] | Copy to clipboard |
Posted by: why Posted on: 2005-04-09 12:03 don't double post!! in fact, you have posted this same topic on 4 different boards! 自从重新装了操作系统 is it Win XP SP2? if so, search on Google to see how to get around the port blocking issue. say, http://support.microsoft.com/kb/841252 (you may also have to upgrade your SQL Server to SP3 if you haven't yet.) |
3.Re:JSP连接SQL server 2000的问题,先谢谢啦 [Re: jmszcy01061] | Copy to clipboard |
Posted by: ququ_0811 Posted on: 2005-05-14 20:45 问一下!win2000也要吗? |
4.Re:JSP连接SQL server 2000的问题,先谢谢啦 [Re: ququ_0811] | Copy to clipboard |
Posted by: why Posted on: 2005-05-14 21:53 ququ_0811 wrote: 要甚麼? 問問題可不可以問得仔細一點? 不要讓人猜. answer: I don't know whethter the port will be blocked on Windows 2000 -- you never know what M$ could possibly do. Anyway, SP3a for SQL Server is suggested. |
5.Re:JSP连接SQL server 2000的问题,先谢谢啦 [Re: jmszcy01061] | Copy to clipboard |
Posted by: ququ_0811 Posted on: 2005-05-15 22:47 老大!不好意思我是个新手,在连接据库时遇到麻烦,我用的是win2000+sp2,tomcat,sql server2000可就是连不上,在telnet 127.0.0.1 1433是不通!我想问问是不是端口问题? 多谢大哥了!!! |
6.Re:JSP连接SQL server 2000的问题,先谢谢啦 [Re: ququ_0811] | Copy to clipboard |
Posted by: why Posted on: 2005-05-15 23:09 ququ_0811 wrote: Check whether TCP/IP is enabled and if so, what the port is with SQL Server Network Utility -- I am not too familiar with SQL Server so I don't know the proper command line tools to do this. BTW, consider upgrading to Windows 2000 SP4. |
7.Re:JSP连接SQL server 2000的问题,先谢谢啦 [Re: jmszcy01061] | Copy to clipboard |
Posted by: ququ_0811 Posted on: 2005-05-17 19:09 谢谢 老大! |
8.Re:JSP连接SQL server 2000的问题,先谢谢啦 [Re: ququ_0811] | Copy to clipboard |
Posted by: why Posted on: 2005-05-17 23:04 ququ_0811 wrote: As I mentioned in another post, I don't care about 谢谢 but I would like to know whether a problem is solved and how. |
9.Re:JSP连接SQL server 2000的问题,先谢谢啦 [Re: jmszcy01061] | Copy to clipboard |
Posted by: tjlgdx Posted on: 2005-05-18 14:41 XP下也有这个问题,最后必的我用桥接 |
10.Re:JSP连接SQL server 2000的问题,先谢谢啦 [Re: jmszcy01061] | Copy to clipboard |
Posted by: ququ_0811 Posted on: 2005-05-21 11:07 已经解决了! |
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 |