Reputation: 295
I have searched quite awhile on this but have not found out a solution yet, I am currently trying to establish a connection to SQL Server
Connection con = ds.getConnection
but am getting this exception:
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"
This is due to the driver being unable to establish a SSL connection.
I have been able to verify that I am able to ping and view the database without any issues but somehow still getting this error.
The cause as listed is:
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"
For the same reason as above, not able to establish the SSL connection.
In context.xml I have listed:
<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" />
I am obtaining the datasource like so:
InitialContext ic = new InitialContext();
ds = (DataSource)ic.lookup("java:comp/env/jdbc/sqlazure");
So encrypt is set to true as well. I was not seeing this issue before and the only thing I can think of is that I did install Android Studio recently, not sure if this messed up the Java settings somehow ?
I am using Eclipse Oxygen June 2017, Java 1.8.0_141, Tomcat 8.5
Upvotes: 0
Views: 2132
Reputation: 295
For those who may have seen the same issue, I was able to resolve this by upgrading the SDK to 1.8.0_141 and pointing Eclipse to use the new JRE environment. I made the mistake of leaving Eclipse pointing to the old JRE environment.
However, it was working before I updated the JDK to 1.8.0_141 from 1.8.0_77, am not sure yet what differences there are between the versions, or if there was some updates on the Azure end that required an update to at least version 1.8.0_141. Any insights on this would be interesting to hear
Upvotes: 1