0
I’m having trouble connecting via JDBC in the AZURE Sqlserver database using encryption.
My connection string is as follows:
jdbc:sqlserver://servidor.database.windows.net:1433;
Database=BASE_DE_DADOS;
User=Usuario@servidor;
password=senha;
Trusted_Connection=False;
Encrypt=False;
hostNameInCertificate=*.database.windows.net;
That way it works, but if I change it to Encrypt=True;
I get the following error:
com.microsoft.sqlserver.jdbc.Sqlserverexception: Driver could not establish a secure connection to SQL Server using encryption SSL. Error: "java.security.cert.Certificateexception: Failed to validate the server name in a certificate during startup of the SSL protocol (Secure Sockets Layer)
My version of Java is 1.8.0_91
And I’m using the sqljdbc4.jar
Grateful to anyone who can help me in resolving this issue.
This link says that the server name in the connection chain does not match the server name in the SSL certificate. But another program here in the company written in C# connects that same Azure server with that connection string while the other one written in Java has this problem. I am already thinking that this message is wrong and that the problem, in fact, is another.
– Reginaldo Rigo