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 MS Sql server2000 connection problem 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 "MS Sql server2000 connection problem" Watch "MS Sql server2000 connection problem" New topic

MS Sql server2000 connection problem

aashini shah

Joined: Feb 06, 2008
Posts: 8
i have following code

import java.sql.*;
import java.*;

class Conn2
public static void main(String args[])throws Exception

Driver d=(Driver)Class.forName("").newInstance();
Connection con=null;

con = DriverManager.getConnection("jdbc:microsoft:sqlserver://localhost:1433;databaseName=pubs","sa", "");
catch(SQLException e)
System.out.println("connection done");


I have installed driver for sql server2000 from

and have also set classpath variable to msutil.jar,msbase.jar and mssqlserver.jar

Exception is coming :
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Error establis
hing socket.
at Source
at Source)
at Source)
at<init>(Unknown Source)

at Sou
at S
at Source)
at Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at Conn2.main(
[Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.

wht should i do??
Paul Sturrock

Joined: Apr 14, 2004
Posts: 10336

Have you configured your SQL Server instance so you can connect to it? Namely: is it using SQL Server authentication (rather than Windows Integrated)? And have TCP/IP connections been enabled?

Also, is there a firewall between you and it? Is the server listening on 1433?

One more thing, why use the 2000 driver? Its bug-ridden and there are far better ones out there (MS have their own 2005 driver that works with 2000 & jTDS have an open source driver that is even better).

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
I agree. Here's the link:
subject: MS Sql server2000 connection problem
It's not a secret anymore!