error:SQLServer 2000 Driver for JDBC]Broken pipe
环境是:linux(red hat) tomcat5.0 java5.0
通过single模式(长连接)来操作sqlserver 2000数据库,一直会报:error:SQLServer 2000 Driver for JDBC]Broken pipe。
通过网上的情况:
http://topic.csdn.net/u/20080119/11/adb37368-5138-43b7-8624-eb18ec14c75f.html
http://forums.java.net/jive/thread.jspa?messageID=272591
发现自己的single,getInstance方法没有加synchronized,这里极有可能参数的线程同步的问题。
经过测试和实际的应用,还是会出现同样的问题,现在的方式是:
每次连接数据时,都将其关闭,下次连接时,重新连接。不使用长连接。
Connection conn = null;
try {
conn = ...;
Statement stmt = null;
try {
stmt = ...;
// Do your thing here
} finally {
if (stmt != null) {
stmt.close();
}
}
} finally {
if (conn != null) {
conn.close();
}
} 相关推荐
ASoc 2020-11-14
Cherishyuu 2020-08-19
dongtiandeyu 2020-08-18
CoderYYN 2020-08-16
大黑牛 2020-08-15
Dullonjiang 2020-08-11
gaozhennan 2020-08-03
mcvsyy 2020-08-02
zbcaicai 2020-07-29
AscaryBird 2020-07-27
liulin0 2020-07-26
ldcwang 2020-07-26
helloxusir 2020-07-25
娜娜 2020-07-20
pengpengflyjhp 2020-07-19
点滴技术生活 2020-07-19
人可 2020-07-18
chenjiazhu 2020-07-08