简体   繁体   中英

Unable to connect to SQL Server via JDBC on Linux

I am able to connect to my SQL Server instance via the following JDBC connection on a Windows machine:

jdbc:sqlserver://<my_server>;databaseName=<my_db>;integratedSecurity=true;authenticationScheme=JavaKerberos;username=<my_user>;password=<my_pwd>

However, when the same connection string is invoked on a Linux machine, I get the following error stack:

com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host <my_server>, port 1433 has failed. Error: "Connection timed out: no further information.. 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.".

I have tried altering the JDBC string to remove the integratedSecurity=true , according to this forum , but I am encountering the same error message.

Is the error message related to authentication or networking? I am able to SSH into the Linux machine and successfully ping <my_server>

I would first try if I can reach 'my_server' on the standard port from your Linux client, eg

    telnet my_server 1433 

as MS Sql Server is listening on port 1433, MySQL is listening on 3306. If this is fine, use the basic URL as duffymo mentioned above. Probably add username and password:
jdbc:sqlserver://myserver:1433;databaseName=my_db;user=my_user;password=my_password

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM