连接db2数据库报错:打开套接字时出错。

wangpeilei_403 2004-09-17 10:13:38
import java.sql.*;
public class Test{
public Test() {
}

public static void main(String[] args) {
try{
Class.forName("COM.ibm.db2.jdbc.net.DB2Driver").newInstance();
String url = "jdbc:db2://10.64.1.202:5000/QICC_DB";
String user = "wpl";
String password = "111";

Connection conn = DriverManager.getConnection(url, user, password);
Statement stmt = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_UPDATABLE);

String sql = "select * from XZ_GDZC";
ResultSet rs = stmt.executeQuery(sql);
while (rs.next()) {
System.out.println(rs.getString(1));
System.out.println(rs.getString(2));
}
}catch(Exception ex)
{
System.out.println(ex);
}

}
}
编译没问题,运行报错
COM.ibm.db2.jdbc.DB2Exception: [IBM][JDBC Driver] CLI0616E 打开套接字时出错。SQ
LSTATE=08S01
...全文
388 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
Collection 2004-09-18
  • 打赏
  • 举报
回复
看了看感觉上不是代码的问题,应该是机器的问题,建议听楼上的从起一下
wangpeilei_403 2004-09-18
  • 打赏
  • 举报
回复
up
redlaputa 2004-09-17
  • 打赏
  • 举报
回复
重启服务器
wangpeilei_403 2004-09-17
  • 打赏
  • 举报
回复
定啊

62,615

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧