• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Al Hobbs
  • Piet Souris
  • Himai Minh

MS Sql server2000 connection problem

Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i have following code

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

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

Driver d=(Driver)Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").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 http://www.microsoft.com/downloads/details.aspx?FamilyID=4f8f2f01-1ed7-4c4d-8f7b-3d47969e66ae&displaylang=en

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 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 Sou
at com.microsoft.jdbc.base.BaseConnection.getNewImplConnection(Unknown S
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 Conn2.main(Conn2.java:14)
[Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.

wht should i do??
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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).
30 seconds to difuse a loaf of bread ... here, use this tiny ad:
Garden Master Course kickstarter
    Bookmark Topic Watch Topic
  • New Topic