sql-serverjdbcsqljdbc

JDBC availability group connection error


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.


Solution

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