请问高手关于jdbc连接sql server问题
import java.sql.*;
public class SQL_JDBC{
public static void main(String[] args){
Connection conn;
String driver= "com.microsoft.jdbc.sqlserver.SQLServerDriver ";
String url= "jdbc:microsoft:sqlserver://127.0.0.1:1433;DatabaseName=pubs ";
String user= "sa ";
String pwd= " ";
try{
Class.forName(driver);
conn=DriverManager.getConnection(url,user,pwd);
Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
String sql= "select * from jobs ";
ResultSet rs=stmt.executeQuery(sql);
while(rs.next()){
System.out.print( " "+rs.getInt(1));
System.out.println( "\t "+rs.getString(2));
}
stmt.close();
conn.close();
System.out.println( "\n "+ "Test ok! ");
}catch(
ClassNotFoundException e){
System.out.println( "未找到要加载的驱动类 ");
}catch(
SQLException e){
System.out.println( "SQL错误提示: "+e);
}
}
}
运行时显示:[Microsoft][SQL server200 Driver for JDBC]Error establishing socket
请问如何解决
------解决方案--------------------Error establishing socket 很明显是端口问题,程序并没有错
可能性比较大的还是补丁问题,SQL SERVER 2000要SP3以上的补丁