连续几天都发生这样的错误,心急如焚,求救!
日志如下:
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:525)
at java.sql.DriverManager.getConnection(DriverManager.java:171)
at com.cba.dbconnect.Connect.getConnection(Connect.java:23)
at com.cba.dbconnect.QueryBean. <init> (QueryBean.java:16)
at org.apache.jsp.detail_jsp._jspService(detail_jsp.java:81)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
这段日志中三个应用程序的关系是detail.jsp在第81行调用QueryBean.java,该java程序在第16行调用Connect中的getConnection,那最后是不是表示Connect.java代码的第23行有问题?
产生问题的环境描述:
网站流量每天在300左右,并发连接数在20之内。
这个错误并不是每次调用该程序都产生的,请教各位dx为什么有时候会报上述的错误呢?
Connect.java代码如下:
package com.cba.dbconnect;
import java.sql.*;
import java.lang.*;
import java.util.*;
public class Connect {//数据库连接源调用getConnection方法
Connection conn = null;
String sDBDriver= "com.microsoft.jdbc.sqlserver.SQLServerDriver ";
String sConnStr = "jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=test ";
String sDBuser = "sa ";
String sDBpswd = "123456 ";
public Connection getConnection() throws Exception
{
try{
Class.forName(sDBDriver);
系统报错行---conn=DriverManager.getConnection(sConnStr,sDBuser,sDBpswd);
}catch (Exception e){
//System.out.println( "无法建立数据库链接 "+e.getMessage());
e.printStackTrace();
}
return conn;
}
}
在线等!多谢各位!
------解决方案--------------------
sql server 打sp4补丁
------解决方案--------------------
让服务商打补丁
------解决方案--------------------
补丁
------解决方案--------------------
sp4
------解决方案--------------------
sp4