Hi all,

I am attempting to connect to a MS SQL Server Express Edition with Advanced Services (MS SQL10) on a remote Windows NT 5.2 machine on the LAN.

My driver is net.sourceforge.jtds.jdbc.Driver
My url for the connection string is jdbc:jtds:sqlserver://127.68.0.201:1433/LOD
My user is d, password is d.

Now, when I created the user on the server, it connects well soon after, but whenever I attempt to connect via my java program, I get the error as follows:

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 s.test.getConnection(test.java:621)
        at s.test.getArray2(test.java:761)
        at s.test.checkTablez(test.java:80)
        at s.test.doSmartCheck(test.java:452)
        at s.test.run(test.java:62)
        at java.lang.Thread.run(Thread.java:619)
Caused by: java.net.ConnectException: Connection refused: connect
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
        at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
        at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
        at java.net.Socket.connect(Socket.java:519)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

So far I have ensured that:
1. TCP/IP settings on the MS SQL Server Configuration Manager have been enabled both underSQL Server Network Configuration and SQL Native Client 10.0.
2. the firewall is off in the machine where the SQL Server is resident.
3. the user I am using to connect to the database is well defined for SQL Server Authentication and not Windows Authentication, since if I created the user for Windows Authentication then I would not be able to connect this way.
4. the jTDS Driver's jar file is in the classpath as required.

Hence, I am still puzzled as to why I still get this error, and yet in FAQ of the driver's (jTDS) official website they have suggested that the above scenarios could be the most likely causes of this.

Please assist me with some really mind opening insights...
Thanks in advance

Hi all,

I am attempting to connect to a MS SQL Server Express Edition with Advanced Services (MS SQL10) on a remote Windows NT 5.2 machine on the LAN.

My driver is net.sourceforge.jtds.jdbc.Driver
My url for the connection string is jdbc:jtds:sqlserver://127.68.0.201:1433/LOD
My user is d, password is d.

Now, when I created the user on the server, it connects well soon after, but whenever I attempt to connect via my java program, I get the error as follows:

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 s.test.getConnection(test.java:621)
        at s.test.getArray2(test.java:761)
        at s.test.checkTablez(test.java:80)
        at s.test.doSmartCheck(test.java:452)
        at s.test.run(test.java:62)
        at java.lang.Thread.run(Thread.java:619)
Caused by: java.net.ConnectException: Connection refused: connect
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
        at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
        at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
        at java.net.Socket.connect(Socket.java:519)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

So far I have ensured that:
1. TCP/IP settings on the MS SQL Server Configuration Manager have been enabled both underSQL Server Network Configuration and SQL Native Client 10.0.
2. the firewall is off in the machine where the SQL Server is resident.
3. the user I am using to connect to the database is well defined for SQL Server Authentication and not Windows Authentication, since if I created the user for Windows Authentication then I would not be able to connect this way.
4. the jTDS Driver's jar file is in the classpath as required.

Hence, I am still puzzled as to why I still get this error, and yet in FAQ of the driver's (jTDS) official website they have suggested that the above scenarios could be the most likely causes of this.

Please assist me with some really mind opening insights...
Thanks in advance

It seems this has eluded everyone here as per now...
Anyway, i have opened command prompt window of the machine via remote desktop and done the following test:
telnet 127.0.0.1 1433 and since this was also refused connection, I have let the system admin know and follow up on this.
I hope this would resolve this issue once and for all

if I remember correctly, for MsSql Express is syntax little bid different, search for that because this syntax must contains word Express before IP address

if I remember correctly, for MsSql Express is syntax little bid different, search for that because this syntax must contains word Express before IP address

You are right as regards the querying syntax being different from the widely known SQL.
However, for my case the program has connected once the system administrator opened up the port 1433.

Thanks anyway mKorbel.

This question has already been answered. Start a new discussion instead.