myeclipse中sqlserver2000获取连接错误是怎么回事
con=DriverManager.getConnection("jdbc:microsoft:sqlserver://localhost:1433;DatabaseNa...
con=DriverManager.getConnection("jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=news");
错误:
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.
at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSConnection.<init>(Unknown Source)
at com.microsoft.jdbc.sqlserver.SQLServerImplConnection.open(Unknown Source)
at com.microsoft.jdbc.base.BaseConnection.getNewImplConnection(Unknown Source)
at com.microsoft.jdbc.base.BaseConnection.open(Unknown Source)
at com.microsoft.jdbc.base.BaseDriver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:207)
at com.News.NewsFirstTitleDB1.main(NewsFirstTitleDB1.java:21) 展开
错误:
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.
at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSConnection.<init>(Unknown Source)
at com.microsoft.jdbc.sqlserver.SQLServerImplConnection.open(Unknown Source)
at com.microsoft.jdbc.base.BaseConnection.getNewImplConnection(Unknown Source)
at com.microsoft.jdbc.base.BaseConnection.open(Unknown Source)
at com.microsoft.jdbc.base.BaseDriver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:207)
at com.News.NewsFirstTitleDB1.main(NewsFirstTitleDB1.java:21) 展开
3个回答
展开全部
好久没弄这个了,看你的代码应该是没错,报的错是与数据库建立连接的时候出错,一般这类问题你首先确定数据库连接是连通的,然后确定你的相关架包导入正确,一步步排查
来自:求助得到的回答
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
你使用什么jar包
追问
sqlserver2000 的jar包
追答
去检查一下sqlserver2000的端口是不是1433
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询