JDBC availability group connection error - sql-server

I'm trying to connect to an availability group through sqljdbc driver v4, but I get an error
com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the
host ..., port 1433 has failed. Error: ".... 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.".
The connection string is
jdbc:sqlserver://...;multiSubnetFailover=true;databaseName=...;responseBuffering=full;selectMethod=direct;user=...;password=...
Any ideas what could get wrong? I connect fine if I use the machine name directly, and the 1433 port is open, so it should not be a problem with the port or with the server being up.

The issue was due to the server name, using the fully qualified domain name (FQDN) solved this.

Related

Database connection errors on Jetbrains Rider (Ubuntu 20.04)

I have not found the true way to connect a database on my Jetbrains Rider. How can i fix this error? I did not changed anything. I am just clicking create a Ms Sql, trying test connection, and having that error.
[08S01] 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.".

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, e.g.
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

Connection failure while connecting mssql server using datagrip ubuntu

I have remote mssql server database but when I try it connect to the database using datgrip on ubuntu . I am getting the following error:
The TCP/IP connection to the host xx.xxx.xx.xx, port 1443 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 .

Google Search Appliance: com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host "xyz" port 1433 has failed.

I'm deploying google search appliance connector for database(SQL). When I run my "run.bat", I got an error in my logs which says:
java.io.IOException: com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host "xyz", port 1433 has failed. Error: "null. 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.google.enterprise.adaptor.database.DatabaseAdaptor.getDocIds(DatabaseAdaptor.java:235)
at com.google.enterprise.adaptor.DocIdSender.pushFullDocIdsFromAdaptor(DocIdSender.java:69)
at com.google.enterprise.adaptor.GsaCommunicationHandler$PushRunnable.run(GsaCommunicationHandler.java:856)
at com.google.enterprise.adaptor.OneAtATimeRunnable.run(OneAtATimeRunnable.java:69)
at com.google.enterprise.adaptor.ShutdownWaiter$NotificationRunnable.run(ShutdownWaiter.java:183)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
I have tried the below solutions:
Remove All the TCP Dynamic Ports and Add value of 1433 to all TCP Port and restart your SQL Server.
My SQL Server Configuration looks like this:
Check the value of key TcpDynamicPorts.
I don't have my dynamic port set.
Is there any other way to solve this error. Any help would be appreciated.
Make sure that all TCP Dynamic ports are set to 0 and TCP Ports is blank on all except IPALL which your current setting is correct.
It looks like a communication problem between your application server and the SQL Server. I would suggest checking the port using TELNET in a CMD window with either the IP Address of the SQL server or domain name.
TELNET pc.name.com 1433
or
TELNET 172.0.0.1 1433
If you get a blank screen after this you were successful and the port is open. If not, there is a firewall or network setting blocking the connection.

MSSQL 2008: Connection string error

In my config.properties I have:
url = jdbc:sqlserver://ABC\SQLSERVER2008:1433;databasename=M4E;username=sa;password=123456
driver = com.microsoft.sqlserver.jdbc.SQLServerDriver
but it doesn't properly connect to the DB. I get the error:
com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host ABCSQLSERVER2008, port 1433 has failed. Error: "null.
Verify the connection properties, check that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port, and that no firewall is blocking TCP connections to the port.".
When I debug, it appears ABCSQLSERVER2008, not ABC\SQLSERVER2008 as I expect.
Can anyone help me about this?
Please try:
url = jdbc:sqlserver://ABC\\SQLSERVER2008:1433;databasename=M4E;username=sa;password=123456

Resources