找遍了很长一段时间在这一点,但还没有找到了解决办法尚未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