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.micros
????????

解决方案 »

  1.   

    没有装sql补丁,sql为什么需要装补丁阿?
    补丁是用来做什么的?别的 数据库也需要吗/
      

  2.   

    package org.esdimserver.data.pool;import java.sql.Connection;
    import java.sql.Driver;
    import java.sql.DriverManager;
    import java.sql.SQLException;
    import java.util.Timer;
    import java.util.TimerTask;import org.esdimserver.cmd.CMD_Server;/**
     * 
     * **********模块说明**************
     * 
     * getInstance()返回POOL唯一实例,第一次调用时将执行构造函数
     * 构造函数Pool()调用驱动装载loadDrivers()函数;连接池创建createPool()函数 loadDrivers()装载驱动
     * createPool()建连接池 getConnection()返回一个连接实例 getConnection(long time)添加时间限制
     * freeConnection(Connection con)将con连接实例返回到连接池 getnum()返回空闲连接数
     * getnumActive()返回当前使用的连接数
     * 
     */
    public class Pool extends CMD_Server{
    /**
     * 定义唯一实例
     */
    static private Pool instance = null;
    /**
     * 最大连接数
     */
    private int maxConnect = Integer.parseInt(rc.getValue("maxConnect"));
    /**
     * 保持的连接数
     */
    private int normalConnect = Integer.parseInt(rc.getValue("normalConnect"));;
    private String password = rc.getValue("DB_PASSWORD");// 密码
    private String url = rc.getValue("DB_URL");// 连接URL
    private String user = rc.getValue("DB_USER");// 用户名
    private String driverName = rc.getValue("JDBC_DRIVER");// 驱动类
    /**
     * 驱动变量
     */
    Driver driver = null;
    /**
     * 连接池实例变量
     */
    DBConnectionPool pool = null;
    /**
     * 连接池计时器
     */
    Timer poolTimer = new Timer(); /**
     * 返回唯一实例
     * 
     * @return instance
     */
    static synchronized public Pool getInstance() {
    if (instance == null) {
    instance = new Pool();
    }
    return instance;
    } public Pool() {
    loadDrivers(driverName);
    createPool(); } /**
     * 装载和注册所有JDBC驱动程序
     * 
     * @param dri
     */
    private void loadDrivers(String dri) { String driverClassName = dri;
    try {
    driver = (Driver) Class.forName(driverClassName).newInstance();
    DriverManager.registerDriver(driver);
    System.out.println("成功注册JDBC驱动程序" + driverClassName);
    } catch (Exception e) {
    System.out.println("无法注册JDBC驱动程序:" + driverClassName + ",错误:" + e);
    }
    } /**
     * 创建连接池
     */
    private void createPool() {
    pool = new DBConnectionPool(password, url, user, normalConnect,
    maxConnect);
    start();
    if (pool != null) {
    System.out.println("创建连接池成功");
    } else {
    System.out.println("创建连接池失败");
    }
    } /**
     * 获得一个可用的连接,如果没有则创建一个连接,且小于最大连接限制
     * 
     * @return
     */
    public Connection getConnection() {
    if (pool != null) {
    return pool.getConnection();
    }
    return null;
    } /**
     * 获得一个连接,有时间限制
     * 
     * @param time
     * @return
     */
    public Connection getConnection(long time) {
    if (pool != null) {
    return pool.getConnection(time);
    }
    return null;
    } /**
     * 将连接对象返回给连接池
     * 
     * @param con
     */
    public void freeConnection(Connection con) {
    if (pool != null) {
    pool.freeConnection(con);
    }
    } /**
     * 返回当前空闲连接数
     * 
     * @return
     */
    public int getnum() {
    return pool.getnum();
    } /**
     * 返回当前连接数
     * 
     * @return
     */
    public int getnumActive() {
    return pool.getnumActive();
    } /**
     * 关闭所有连接,撤销驱动注册
     */
    public synchronized void release() { // /关闭连接
    pool.release(); // /撤销驱动
    try {
    DriverManager.deregisterDriver(driver);
    System.out.println("撤销JDBC驱动程序 " + driver.getClass().getName());
    } catch (SQLException e) {
    System.out
    .println("无法撤销JDBC驱动程序的注册:" + driver.getClass().getName());
    } } /**
     * 启动连接池计时器 每隔10秒钟扫描一次列表
     */
    public void start() {
    poolTimer.schedule(new TimerTask() {
    public void run() {
    pool.freeConnectionsTime();
    }
    }, 0 * 1000, 1 * 60 * 1000);
    }
    }
      

  3.   

     估计是没升级补丁,我以前也遇到过,不过现在改用Oracle,MySQL了。
      

  4.   

    是没有打补丁!!!!!!你的1433或者其他的默认端口没有打开...你可以在启动-->CMD-->NETSTAT -A看看1433端口打开了没有.或者用SQLSERVER2000的服务器网络实用工具中的协义TCP/IP 里设置的是哪个端口!!!