2017-07-19 61 views
0

找遍了很長一段時間在這一點,但還沒有找到了解決辦法尚未SSL連接,目前我正在試圖建立到SQL服務器JDBC SQL服務器無法建立

Connection con = ds.getConnection 

連接,但我得到這個例外:

Cannot create PoolableConnectionFactory (The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: Broken pipe ClientConnectionId:8fb783f6-2790-44e9-b459-18238edd23ff" 

這是由於驅動程序無法建立SSL連接。

我已經能夠驗證,我能ping和查看數據庫沒有任何問題,但不知何故仍然得到這個錯誤。

原因由於上市是:

com.microsoft.sqlserver.jdbc.SQLServerException (The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: Broken pipe ClientConnectionId:8fb783f6-2790-44e9-b459-18238edd23ff" 

出於同樣的理由如上,無法建立SSL連接。

在context.xml中我列出:

<Resource name="jdbc/sqlazure" 
auth="Container" 
driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver" 
type="javax.sql.DataSource" 
maxIdle="30" 
username="username" 
password="password 
url="jdbc:sqlserver://axpert.database.windows.net:1433;database="db";encrypt=true;trustServerCertificate=false;hostNameInCertificate="database";loginTimeout=30" 
removeAbandonedTimeout="30" 
logAbandoned="true" /> 

我獲得像這樣的數據源:

InitialContext ic = new InitialContext(); 
      ds = (DataSource)ic.lookup("java:comp/env/jdbc/sqlazure"); 

所以加密設置爲true也是如此。我之前沒有看到這個問題,我能想到的唯一的事情是我最近安裝了Android Studio,不確定這是否會以某種方式搞砸了Java設置?

我使用Eclipse氧氣2017年6月,爪哇1.8.0_141下,Tomcat 8.5

回答

1

對於那些誰可能已經看到了同樣的問題,我能解決這個由SDK升級到1.8.0_141和指點的Eclipse使用新的JRE環境。我犯了讓Eclipse指向舊的JRE環境的錯誤。

但是,在將JDK從1.8.0_77更新到1.8.0_141之前,它正在工作,我不確定這些版本之間存在什麼差異,或者是否需要更新到Azure端的某些更新至少版本1.8.0_141。任何關於此的見解都會很有趣聽到