2013-09-24 310 views
-3

當我試圖通過jdbc連接eclipse與sql服務器時,我得到了這2個錯誤。任何人都可以幫助我解決這個問題或解釋爲什麼GETTING這個??主機localhost,端口1433的TCP/IP連接失敗

1.與主機localhost,端口1433的TCP/IP連接失敗.2。驅動程序無法使用安全套接字層(SSL)加密與SQL Server建立安全連接。

謝謝..

這是我工作的代碼。

String driver = "com.microsoft.sqlserver.jdbc.SQLServerDriver"; 
Class.forName(driver).newInstance(); 
String connString ="jdbc:sqlserver://localhost:1433/databaseName=Engg_Street;instance=SQLSERVER;encrypt=true;  trustServerCertificate=true"; 
String username = "Vijayalakshmi"; 
String password = ""; 
conn = DriverManager.getConnection(connString,username,password); 
+0

參考以下鏈接 http://stackoverflow.com/questions/11820799/com-microsoft-sqlserver-jdbc-sqlserverexception-the-tcp-ip-connection-to-the-ho – sunysen

+0

是SQL由於SQL Server 2005,TCP/IP在端口1433,IIRC上運行,默認情況下禁用TCP/IP,如果啓用,它默認使用隨機端口。 –

+0

不要多次發佈相同的問題,而應該編輯現有的帖子,如果您認爲需要澄清的話! –

回答

0

從連接字符串中取出encrypt=true;trustServerCertificate=true。您的SQL Server可能未設置爲使用SSL進行連接。

相關問題