Unable to establish sql server connection from my rh vm to the windows sql server

Latest response

Hi team,Good day...
1:I am running rhel7.4 (on a virtual box) and jboss eap7(on the same virtual box) to deploy and test my war.
2:The database is residing in my host machine windows 10.
Databases are 1:oracle and 2:microsoft sql server, both on windows.

3:I have successfully managed to establish connection between the jboss(on the rh vm) and the window oracle db...this is the standalone.xml datasource snippet:

               <datasource jndi-name="java:jboss/MEP_DEV_JBOSS_DS_LINUX" pool-name="MEP_DEV_JBOSS_DS_LINUX" enabled="true">
                <connection-url>jdbc:oracle:thin:@172.16.9.116:1521:ORCL</connection-url>
                <driver-class>oracle.jdbc.OracleDriver</driver-class>
                <driver>oracle</driver>
                <security>
                    <user-name>MEP_DEV_LINUX</user-name>
                    <password>MEP_DEV_LINUX</password>
                </security>
            </datasource>

4:Issue!!! : I am failing to establish connection to the ms sql server from the jboss ... i have tried so many combinations and other desperate tweakings to the standalone datasource subsystem configurations but no success.

My sql ds configuration snippet:

            <!--<connection-url>jdbc:sqlserver://172.16.9.116:1433/master</connection-url> -->
            <connection-url>jdbc:sqlserver://172.16.9.116:1433/master;databaseName=master;</connection-url>
            <!-- <connection-url>jdbc:microsoft:sqlserver://172.16.9.116/1433;DatabaseName=master</connection-url> -->
            <driver-class>com.microsoft.sqlserver.jdbc.SQLServerDriver</driver-class>
            <driver>mssql</driver>
            <security>
                <user-name>sa</user-name>
                <password>ridiculus123</password>
            </security>

I am constantly getting this error--->
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host localhost, port 1433 has failed. Error: "Connection refused. Verify the connection properties. Make sure that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. Make sure that TCP connections to the port are not blocked by a firewall.".
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:206)
at com.microsoft.sqlserver.jdbc.SQLServerException.ConvertConnectExceptionToSQLServerException(SQLServerException.java:257)
at com.microsoft.sqlserver.jdbc.SocketFinder.findSocket(IOBuffer.java:2385)
at com.microsoft.sqlserver.jdbc.TDSChannel.open(IOBuffer.java:567)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:1955)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:1616)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(SQLServerConnection.java:1447)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:788)
at com.microsoft.sqlserver.jdbc.SQLServerDataSource.getConnectionInternal(SQLServerDataSource.java:719)
at com.microsoft.sqlserver.jdbc.SQLServerDataSource.getConnection(SQLServerDataSource.java:79)
at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createLocalManagedConnection(LocalManagedConnectionFactory.java:314)
... 27 more

5: Its very importannt for me to inform that I am not getting any errors while testing the jboss in my windows. its all cool.

Please help guys...on edge here.

Responses

I have the same problem,

Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: No se pudo realizar la conexión TCP/IP al host localhost, puerto 1433. Error: "Conexión rehusada (Connection refused). Verifique las propiedades de conexión, compruebe que hay una instancia de SQL Server ejecutándose en el host y aceptando las conexiones TCP/IP en el puerto y compruebe que no hay ningún firewall bloqueando las conexiones TCP en el puerto.".

the server tries to connect to localhost and not to the IP of my database server.