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 configuration Java web application.It shows me error saying
The connection to the host vinayaka.cloudapp.net,555, named instance sqlexpress failed. Error: "java.net.UnknownHostException: vinayaka.cloudapp.net,555". Verify the server and instance names and check that no firewall is blocking UDP traffic to port 1434. For SQL Server 2005 or later, verify that the SQL Server Browser Service is running on the host.
spring-config.xml
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="com.microsoft.sqlserver.jdbc.SQLServerDriver" />
<property name="url" value="jdbc:sqlserver://vinayaka.cloudapp.net,555\sqlexpress;database=Sample" />
<property name="username" value="user" />
<property name="password" value="pass" />
</bean>
Note:
1) I am able to open and work on that server in SQL Server Management Studio.
2) If I am able to open in SQL Server Management Studio, it means my machine IP address is allowed by firewall.
3) I can connect to database created in Azure SQL Database.
Please give suggestion on this.
jdbc:sqlserver://SERVERNAME.database.windows.net:1433;database=spring-boot-intro;encrypt=true;trustServerCertificate=false;hostNameInCertificate=*.database.windows.net;loginTimeout=30;
– andrea-lam-MSFT