Cannot connect to SQL Server 2005 - remote connections

I have one question. I would like to use DB-VA SQL but I cannot connect to my database. I have switched on Remote Connections in my SQL Server (“Using both TCP/IP and named pipes”). After using jtds-1.2.jar I have the following error:

Test adapter connection failed!
java.sql.SQLException: Network error IOException: Connection refused:
connect
at
net.sourceforge.jtds.jdbc.ConnectionJDBC2.(ConnectionJDBC2.java:372)
at
net.sourceforge.jtds.jdbc.ConnectionJDBC3.(ConnectionJDBC3.java:50)
at net.sourceforge.jtds.jdbc.Driver.connect(Driver.java:178)
at org.orm.ertodb.DriverWrapper.connect(DriverWrapper.java:27)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at v.iybj.i(:34)
at v.iybj.f(:43)
at v.yct.run(:21)
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at
net.sourceforge.jtds.jdbc.SharedSocket.createSocketForJDBC3(SharedSocket.java:289)
at net.sourceforge.jtds.jdbc.SharedSocket.(SharedSocket.java:250)
at
net.sourceforge.jtds.jdbc.ConnectionJDBC2.(ConnectionJDBC2.java:297)
… 8 more
Test .NET connection failed!
java.lang.Exception: Wystąpił błąd podczas ustanawiania połączenia z
serwerem. Podczas łączenia się z programem SQL Server 2005 przyczyną tego
błędu może być fakt, że zgodnie z ustawieniami domyślnymi program SQL Server
nie pozwala na połączenia zdalne. (provider: Dostawca TCP, error: 0 - Nie
można nawiązać połączenia, ponieważ komputer docelowy aktywnie go odmawia.)
w System.Data.SqlClient.SqlInternalConnection.OnError(SqlException
exception, Boolean breakConnection)
w
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject
stateObj)
w System.Data.SqlClient.TdsParser.Connect(Boolean& useFailoverPartner,
Boolean& failoverDemandDone, String host, String failoverPartner, String
protocol, SqlInternalConnectionTds connHandler, Int64 timerExpire, Boolean
encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection
owningObject, Boolean aliasLookup)
w
System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection
owningObject, SqlConnectionString connectionOptions, String newPassword,
Boolean redirectedUserInstance)
w
System.Data.SqlClient.SqlInternalConnectionTds…ctor(DbConnectionPoolIdentity
identity, SqlConnectionString connectionOptions, Object providerInfo, String
newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)
w
System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions
options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection
owningConnection)
w
System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection
owningConnection, DbConnectionPool pool, DbConnectionOptions options)
w System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection
owningObject)
w
System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection
owningObject)
w System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection
owningObject)
w System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection
owningConnection)
w System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection
outerConnection, DbConnectionFactory connectionFactory)
w System.Data.SqlClient.SqlConnection.Open()
w NHibernate.Connection.DriverConnectionProvider.GetConnection()

I translate java.lang.Exception from Polish:
"Error when establishing connection with server - trying to connect to SQL
Server 2005. The reason of the error can be that according to default
setting SQL Server doesn’t accept remote connections. (TCP Provider, error: 0 - Connection cannot be established because destination computer refuses connection.)

Please help. Thank you.
RM

Hi Robert,

Could you tell me which language you have selected when configuring the database connection setting? Also, could you let me know if your SQL Server is using Window Authentication or SQL Server Authentication? Finally, could you try to telnet to your server machine (telnet %Host% 1433) and see if it is possible to establish the connection?

Best regards,
Jick

I selected C#.NET. I use Windows Authentication (PC\Robert - administrator). Telnet localhost 1433 failes.

See attachment.

Hi Robert,

According to the screen capture, your user name and password are not supplied. Could you fill them in and try again? Please let me know if it works.

Best regards,
Jick

Check if you can telnet to the dataserver port from the client machine?
Check if there are any firewall issues that are blocking the connection?

good luck.

Hi,

I am having the same problem as Robert and need some help. I did what Jick said but still nothing. Any help would be appreciated thanks.


Discounted Softwares!!

Hello tekn1q,

Would you mind send me the error message and the screenshot of your database configuration setting to have a look?

Best regards,
Rain Wong