不能使用弹簧连接到SQL Azure的数据库服务器

问题描述:

我能够连接到由具有IP地址数据库,但如果
我有我的数据库SQL Azure的数据库服务器创建在我不能够使用Spring配置的Java Web application.It再与我联系显示错误说

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

主机vinayaka.cloudapp.net,555的连接,命名实例sqlex preSS失败。错误:的java.net.UnknownHostException:vinayaka.cloudapp.net,555。验证服务器和实例名称并确认是否有防火墙2005或更高版本阻止UDP流量端口1434对于SQL Server,验证SQL Server Browser服务在主机上运行。

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.

春季-config.xml中

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> 

请注意:

1)我能够打开和SQL Server Management Studio中的服务器上运行。

1) I am able to open and work on that server in SQL Server Management Studio.

2)如果我能够在SQL Server Management Studio打开,这意味着我的机器的IP地址是由防火墙。

2) If I am able to open in SQL Server Management Studio, it means my machine IP address is allowed by firewall.

3)我可以连接到SQL Azure的数据库创建的数据库。

3) I can connect to database created in Azure SQL Database.

请在此给出建议。

Azure的SQL数据库的用于JDBC的连接字符串像jdbc:sqlserver://<hostname>.database.windows.net:1433;database=<dbname>;user=<user>@<hostname>;password={your_password_here};encrypt=true;hostNameInCertificate=*.database.windows.net;loginTimeout=30;$c$c>.

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;.

您可以检查在Azure门户旧的或新的门户网站您的Azure SQL数据库的连接字符串,请参见下面的图片。

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

产品图1.检查JDBC连接字符串在Azure门户老

产品图2.检查JDBC连接字符串在Azure上新门户