找遍了很長一段時間在這一點,但還沒有找到了解決辦法尚未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