我也碰到这个问题了,不但是自己手写的Code,还是Jbuilder中链接,都是这个提示:
[Microsoft][SQL Server JDBC Driver]Error Establishing socket
下面是我的代码,虽然我暂时用JdbcOdbc桥绕过去了这个问题,但最终还是要解决的。
public static void main( String args[])
{
try
{
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
String url="jdbc:microsoft:sqlserver://127.0.0.1:1433;DatabaseName=Report";
String user="sa";
String password="";
Connection conn= DriverManager.getConnection(url,user,password);
if ( conn != null)
{
conn.close();
}
}
catch(Exception e)
{
System.out.println(e);
}
}
[Microsoft][SQL Server JDBC Driver]Error Establishing socket
下面是我的代码,虽然我暂时用JdbcOdbc桥绕过去了这个问题,但最终还是要解决的。
public static void main( String args[])
{
try
{
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
String url="jdbc:microsoft:sqlserver://127.0.0.1:1433;DatabaseName=Report";
String user="sa";
String password="";
Connection conn= DriverManager.getConnection(url,user,password);
if ( conn != null)
{
conn.close();
}
}
catch(Exception e)
{
System.out.println(e);
}
}
The ODBC driver
may well be using the default named-pipes access to the DBMS.你可以装个enterprise manager 看看能不能连接到sql server。
你应该在sql server去设置预先tcp/ip连接dbms的监听配置