It's not a secret anymore!
The moose likes JDBC and Relational Databases 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
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Problem connecting JDBC to SQL server 2008 express" Watch "Problem connecting JDBC to SQL server 2008 express" New topic

Problem connecting JDBC to SQL server 2008 express

Ish Fad

Joined: Aug 09, 2011
Posts: 6
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

java.sql.SQLException: Network error IOException: Connection refused: connect
at net.sourceforge.jtds.jdbc.ConnectionJDBC2.<init>(
at net.sourceforge.jtds.jdbc.ConnectionJDBC3.<init>(
at net.sourceforge.jtds.jdbc.Driver.connect(
at java.sql.DriverManager.getConnection(
at java.sql.DriverManager.getConnection(
at conn.DBConnecion.dbConnect(
at conn.TestConnection.main(
Caused by: Connection refused: connect
at Method)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
at java.lang.reflect.Method.invoke(
at net.sourceforge.jtds.jdbc.SharedSocket.createSocketForJDBC3(
at net.sourceforge.jtds.jdbc.SharedSocket.<init>(
at net.sourceforge.jtds.jdbc.ConnectionJDBC2.<init>(

can some one help

many thanks
Paul Clapham

Joined: Oct 14, 2005
Posts: 19973

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:
subject: Problem connecting JDBC to SQL server 2008 express
It's not a secret anymore!