Not able to connect to Azure SQL Database server using spring

前端 未结 3 1104
挽巷
挽巷 2021-01-24 21:24

I am able to connect to database which is having ip address,but if i have my database created in Azure SQL Database server in that i am not able to connect using spring configu

相关标签:
3条回答
  • 2021-01-24 21:56

    The connection string of Azure SQL Database for JDBC is like jdbc:sqlserver://<hostname>.database.windows.net:1433;database=<dbname>;user=<user>@<hostname>;password={your_password_here};encrypt=true;hostNameInCertificate=*.database.windows.net;loginTimeout=30;.

    You can check the connection string of your Azure SQL Database on Azure old portal or new portal, please see the pictures below.

    Pic 1. Check the Connection String for JDBC on Azure old portal

    Pic 2. Check the Connection String for JDBC on Azure new portal

    0 讨论(0)
  • 2021-01-24 22:00

    Is 555 the port, that is exposed by the database for connection? Shouldn't the connection string look like this?

    <property name="url" value="jdbc:sqlserver://vinayaka.cloudapp.net:555\sqlexpress;database=Sample" />  
    

    I have replaced , in your code with :

    0 讨论(0)
  • 2021-01-24 22:15

    Change your connection string like "jdbc:sqlserver://{HostName}.database.windows.net;database={databaseName};encrypt=true;hostNameInCertificate=*.database.windows.net;loginTimeout=30". And use sqljdbc4 jar file. Hope it should work.

    0 讨论(0)
提交回复
热议问题