Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SQL Exception -Error establishing socket

 
Venkatesh Kumar
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All:

I am trying to run a the following java program(http://support.microsoft.com/default.aspx?scid=kb;en-us;313100#6) to connect to sql server 2k database and am using 'Microsoft SQL Server 2000 Driver for JDBC'. When i try to run the program i get the following exception.Can anyone please tell me where I am going wrong...

SQL Exception -error establishing socket.


E:\JavaExamples\JDBC_Examples>javac Connect.java

E:\JavaExamples\JDBC_Examples>java Connect
Before Loading Driver --------
After Loading Driver --------
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 S
ource)
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 Connect.getConnection(Connect.java:44)
at Connect.displayDbProperties(Connect.java:62)
at Connect.main(Connect.java:100)
Error Trace in getConnection() : [Microsoft][SQLServer 2000 Driver for JDBC]Erro
r establishing socket.
Got the connection
Error: No active Connection
 
Pj Murray
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's a few other basic items that you could check:

-TCP/IP connections are disabled by default
-check all port numbers are the same
-confirm that the SQL Server is actually running
-double check user names and passwords. You could check that SQL Server is set to mixed authentication. The driver from Microsoft can not handle Windows integrated authentication (there's third party drivers available that can). To do this, open Enteprrise Manager, right click on the server/properties, and select SQL Server and Windows Authentication in the security tab. Then create an SQL server login account.
-have you installed the SQL Server 2000 Service Pack (it solves a lot of SQL Server problems)?
-check http://support.microsoft.com/default.aspx?scid=kb;en-us;313178



PJ Murray
CodeFutures - Java Code Generation
http://www.codefutures.com
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic