Error connecting to MS SQL 2005

Hi All,

After install and setup SQL server 2005 on Windows 2003 R2 server.
We setup the Windows Firewall giving access to the External and Internal Port 1099 and 8080.

We are able to remotely access to database using ODBC but when tried to create a new connection in Servoy Developer by using mssql_freetds with the following setup

Database Server URL: jdbc:jtds:sqlserver://171.60.60.175/dev

Getting the following error

Cannot setup server:
org.apache.commons.dbcp.DbcpException: java.sql.SQLException: Network error IOException: Connection refused: connect
java.sql.SQLException: Network error IOException: Connection refused: connect
java.net.ConnectException: Connection refused: connect

Please advice.

Thanks,

Here is more info about the SQL Server 2005 connection setup:

I disabled the Windows 2003 R2 firewall. But that didn not help.
In SQL server 2005 for Remote connections:
Enabled Local and Remote connections: Using both TCP/IP and Named Pipes
In TCP/IP Prosperities:

IP Addresses:
IP1: Active: Yes
Enabled: Yes
IP address: the server IP address Example 192.168.0.1
TCP Dynamic port: 0
TCP Port: 1433

IP2: Active: Yes
Enabled: Yes
IP address: the server IP address Example 192.168.0.1
TCP Dynamic port: 0
TCP Port: 1433

IP3: Active: Yes
Enabled: Yes
IP address: the server IP address Example 192.168.0.1
TCP Dynamic port: 0
TCP Port:

IP4: Active: Yes
TCP Dynamic ports: 1053
TCP Port:

For Protocols:
Under general:
Enable: Yes
Keep Alive: 30000
Listen ALL: Yes
No Delay: No

Thanks for any help.

That’s very strange. I use MS SQL without problems. I don’t really know what to tell you!? The machine you are connecting from does get an ODBC connection? Can you connect locally on that server from Servoy?

Patrick,

The Windows Server 2003 R2 and SQL server 2005 are fresh installed.
Yes, I am trying to connect locally on that server from Servoy.
The ODBC works fine.
Is your SQL server 2005? If yes, do you have the same TCP/IP setting like ours?
It is becoming very frustrating for me.
I am wondering if anyone else out there having the same problem.

Yes, poor me sits on Vista and there you only have SQL Server 2005. I simply connect with

jdbc:jtds:sqlserver://localhost/myDb

There is a checkbox in MS SQL Server/properties/connections: Allow remote connections to this server. Is that checked?

in MS SQL Server2005 /properties/connections: Allow remote connections to this server. Is checked.
I ended up uninstalling the entire SQL 2005 server and tools and reinstall and configure it again, but still getting the same error.

There must be a way to make this work
:cry:

  • Are you sure you are connecting to the correct port ?

  • Can you telnet to the port ?

  • Try specifying the portnumber in the connection desciption :

jdbc:jtds:sqlserver://171.60.60.175/dev:1433;user=sa;password=…

( i am not sure if the above syntax is correct)

Hans,

The jdbc:jtds:sqlserver://171.60.60.175/dev:1433;user=sa;password=…
does not work in Servoy DB connection setup.
Telnet to 1433 does not work, but I’m able to connect via ODBC to Port: 1433.

Hi All,

I found the problem. In IPALL for TCP PORT I had nothing in there:

IPALL: Active: Yes
TCP Dynamic ports: 1053
TCP Port:

SO, here is the correct one:

IPALL: Active: Yes
TCP Dynamic ports: 1053
TCP Port: 1433

I guess my weekend just started :twisted:

Regards,

Check if the TCP/IP is enabled in the SQL Server 2005 Configuration Manager (right click on server) .
Search for protocols and check if TCP/IP is enabled.
By default it is disabled. In that case make it enabled.

Martin,

Here is the fix.
Correct:
IPALL: Active: Yes
TCP Dynamic ports: 1053
TCP Port: 1433

Incorrect:
IPALL: Active: Yes
TCP Dynamic ports: 1053
TCP Port:

I had left the "TCP Port: " blank.

It is fixed and up and running now.

Thanks,

Is this also werking with SQL express?

I have SQL express running,
SQL Server Management Studio does connect.
I made a database without tables and try to connect with servoy with

jdbc:jtds:sqlserver://localhost/dbase
net.sourceforge.jtds.jdbc.Driver

The error I got:

org.apache.commons.dbcp.DbcpException: java.sql.SQLException: Network error IOException: Connection refused: connect
java.sql.SQLException: Network error IOException: Connection refused: connect
java.net.ConnectException: Connection refused: connect

I also get the error when using port 1433. TCP is enabled.

Dirc,

This also works for SQL Server 2005 Express.

First activate the TCP/IP option in the SQL Server Configuration Manager, after that double click on the TCP/IP protocol and then:

Activate the IPALL option on the IP Addresses tab:

IPALL: Active: Yes
TCP Dynamic ports: blank.
TCP Port: 1433

After u did this, restart the MSSQL 2005 Express server in the services window, and u should be able to connect to the server with Servoy.