File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases 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
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "SQL Exception -Error establishing socket" Watch "SQL Exception -Error establishing socket" New topic

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(;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>java Connect
Before Loading Driver --------
After Loading Driver --------
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.
at Source)
at Source)
at Source)
at<init>(Unknown Source)
at Source)
at S
at Source)
at Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at Connect.getConnection(
at Connect.displayDbProperties(
at Connect.main(
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)?

PJ Murray
CodeFutures - Java Code Generation
I agree. Here's the link:
subject: SQL Exception -Error establishing socket
It's not a secret anymore!