2013-03-24 101 views
0

在我config.properties我:MSSQL 2008:連接字符串錯誤

url = jdbc:sqlserver://ABC\SQLSERVER2008:1433;databasename=M4E;username=sa;password=123456 
driver = com.microsoft.sqlserver.jdbc.SQLServerDriver 

,但它沒有正確連接到數據庫。我得到的錯誤:

com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host ABCSQLSERVER2008, port 1433 has failed. Error: "null. Verify the connection properties, check that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port, and that no firewall is blocking TCP connections to the port.".

當我調試時,它出現ABCSQLSERVER2008,而不是ABC \ SQLSERVER2008,如我所料。

任何人都可以幫助我嗎?

+0

[connectionstrings.com(http://www.connectionstrings.com) – 2013-03-24 09:34:30

回答

2

請嘗試:

url = jdbc:sqlserver://ABC\\SQLSERVER2008:1433;databasename=M4E;username=sa;password=123456 
+0

這不是關於網址,我得到了這個問題,只需編輯SQL Server網絡配置。在TCP/IP中將TCP端口1433插入IPAII。 – user2204183 2013-03-24 13:39:44