0
votes

I was able to use the JDBC driver that came with DataGrip (I'm using a Mac) and seeing the following error message, it was working perfectly fine before and I didn't disturb anything:

Connection to SQL Azure failed
Driver cannot establish (SSL) connection SQL Server
Error: "java.security.cert.CertificateException: cannot authenticat 
(SSL)  ClientConnectionId:d66ab....

I have tried updating the SQL JDBC driver but still can not see the database content. Any ideas ?

EDIT: This is the stack trace I was able to find:

This is the stack trace I was able to find:[08S01] Driver unable to use SSL to establish secure connection with SQL Server。Error: "java.security.cert.CertificateException: can not verify the name of the server in the security communication layer (SSL) initialization period。"。 ClientConnectionId:b7c55361-d82f-4bc1-b1be-124d18433c3b java.security.cert.CertificateException: can not verify the name of the server in the security communication layer (SSL) initialization period

atcom.microsoft.sqlserver.jdbc.TDSChannel$HostNameOverrideX509TrustManager.validateServerNameInCertificate(IOBuffer.java:1491) at com.microsoft.sqlserver.jdbc.TDSChannel$HostNameOverrideX509TrustManager.checkServerTrusted(IOBuffer.java:1384) at sun.security.ssl.AbstractTrustManagerWrapper.checkServerTrusted(SSLContextImpl.java:922) at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1488) at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:216) at sun.security.ssl.Handshaker.processLoop(Handshaker.java:979) at sun.security.ssl.Handshaker.process_record(Handshaker.java:914) at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1062) at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1375) at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1403) at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1387) at com.microsoft.sqlserver.jdbc.TDSChannel.enableSSL(IOBuffer.java:1688) at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:1977) at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:1628) at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(SQLServerConnection.java:1459) at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:773) at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:1168) at com.intellij.database.remote.jdbc.impl.RemoteDriverImpl.connect(RemoteDriverImpl.java:27) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:323) at sun.rmi.transport.Transport$1.run(Transport.java:200) at sun.rmi.transport.Transport$1.run(Transport.java:197) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.Transport.serviceCall(Transport.java:196) at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$256(TCPTransport.java:683) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745)

1
how your code look like?YCF_L
I am using DataGrip, a Mac application to view database tables, run queries, etc, I am wondering if microsoft updated the jdbc driver or somethingfobius
Try to add the SSL cert to your keystore.JonahCui
I can try that, didn't need to do that before though, I'm connecting to SQL Azure in this case, how would I get the SSL cert?fobius
Another update. I used the exact connection string that Azure tells me but am now seeing a "Connection to SQL Azure failed Broken pipe" message.fobius

1 Answers

0
votes

Thanks all for your help. I've investigated and found that the issue could be related to the fact I upgraded to OS Sierra and then DataGrip seemed to break. The solution that I found was the following:

If the hostname of the connecting client is not set or ends with .local, the connection will fail. After I set the hostname, then it was working again.