Search code examples
azurespring-bootjdbcazure-sql-databaseazure-sql-server

Connection String for JDBC when adding failover groups on azure sql server


I have a primary sql server1 (server1.database.windows.net) in region A with a single db("demo").

Then,I set up auto failover group for server 1 by creating a secondary server 2 (server2.database.windows.net) in region B for the same db.

When I tried to connect using my-failover-group-name.database.windows.net as the server URL from my springboot app, it does not let me connect.

Currently using the JDBC connection string:-

jdbc:sqlserver://<my-failover-group-name>:1433;database=demo;encrypt=true;trustServerCertificate=false;loginTimeout=30;applicationIntent=ReadWrite;

Am I doing something wrong ? I would greatly appreciate any help.


Solution

  • Firstly, please checked firewall rule for your Azure SQL Database server.