aspose file tools*
The moose likes JDBC and the fly likes Problem connecting JDBC to SQL server 2008 express Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Problem connecting JDBC to SQL server 2008 express" Watch "Problem connecting JDBC to SQL server 2008 express" New topic
Author

Problem connecting JDBC to SQL server 2008 express

Ish Fad
Greenhorn

Joined: Aug 09, 2011
Posts: 5
Hi
I am trying to connect to SQLServer 2008 Express.
I have downloaded jtds-1.2.5.jar.
I have enable TCP/IP and user and password do exist with full right.

I am getting following error

<code>
java.sql.SQLException: Network error IOException: Connection refused: connect
at net.sourceforge.jtds.jdbc.ConnectionJDBC2.<init>(ConnectionJDBC2.java:410)
at net.sourceforge.jtds.jdbc.ConnectionJDBC3.<init>(ConnectionJDBC3.java:50)
at net.sourceforge.jtds.jdbc.Driver.connect(Driver.java:184)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:185)
at conn.DBConnecion.dbConnect(DBConnecion.java:10)
at conn.TestConnection.main(TestConnection.java:9)
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:529)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at net.sourceforge.jtds.jdbc.SharedSocket.createSocketForJDBC3(SharedSocket.java:307)
at net.sourceforge.jtds.jdbc.SharedSocket.<init>(SharedSocket.java:257)
at net.sourceforge.jtds.jdbc.ConnectionJDBC2.<init>(ConnectionJDBC2.java:311)
</code>

can some one help

many thanks
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18987
    
    8

So the database server isn't listening at whatever port you specified.

Have you checked with the manager of the database server that it is actually listening at that port? Remember that SQL Server doesn't support TCP/IP access by default, it has to be turned on.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem connecting JDBC to SQL server 2008 express