This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JDBC and the fly likes SQL Exception -Error establishing socket Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "SQL Exception -Error establishing socket" Watch "SQL Exception -Error establishing socket" New topic
Author

SQL Exception -Error establishing socket

Venkatesh Kumar
Ranch Hand

Joined: Aug 08, 2003
Posts: 68
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

Joined: Sep 24, 2004
Posts: 194
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
 
jQuery in Action, 2nd edition
 
subject: SQL Exception -Error establishing socket
 
Similar Threads
connect to SQLServer Database in XP?
Connection through Applet using SQLServer 2000 Driver for JDBC
Why cant connect to another computer in lan?
MS Sql server2000 connection problem
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing.