晓风残月
新手上路
posts - 6,comments - 49,trackbacks - 0

使用MS Sql2000 for JDBC SP3连接MS Sql2000出现如下错误:

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(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at drawServlet.doGet(drawServlet.java:
50 )
    at drawServlet.doPost(drawServlet.java:
18 )
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:
709 )
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:
802 )
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
237 )
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
157 )
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:
214 )
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:
104 )
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:
520 )
    at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:
198 )
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:
152 )
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:
104 )
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:
520 )
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:
137 )
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:
104 )
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:
118 )
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:
102 )
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:
520 )
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:
109 )
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:
104 )
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:
520 )
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:
929 )
    at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:
160 )
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:
799 )
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:
705 )
    at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:
577 )
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:
683 )
    at java.lang.Thread.run(Unknown Source)
java.sql.SQLException: 
[ Microsoft ][ SQLServer 2000 Driver for JDBC ] End of stream was detected on a read.
    at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
    at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
    at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReply(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(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at drawServlet.doGet(drawServlet.java:
92 )
    at drawServlet.doPost(drawServlet.java:
18 )
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:
709 )
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:
802 )
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
237 )
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
157 )
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:
214 )
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:
104 )
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:
520 )
    at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:
198 )
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:
152 )
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:
104 )
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:
520 )
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:
137 )
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:
104 )
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:
118 )
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:
102 )
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:
520 )
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:
109 )
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:
104 )
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:
520 )
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:
929 )
    at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:
160 )
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:
799 )
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:
705 )
    at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:
577 )
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:
683 )
    at java.lang.Thread.run(Unknown Source)

原因:由于开发环境是Win 2003 Server,故SQL 2000需要补丁包,不然在2k3下,SQL默认关闭了TCP连接
解决:打上SQL serverSP4 就OK了 
posted @ 2006-06-10 15:35 jinglecat 阅读(22194) | 评论 (41)编辑 收藏