-1

The problem that we are facing is well documented in https://stackoverflow.com/questions/34189756/warning-about-ssl-connection-when-connecting-to-mysql-database.

We started facing this issue upon transitioning from MySQL 5.6.51 to MySQL 8.0.27. The fix that is suggested works for us but we have an issue in that we don’t want to update the Java source files to change, for example, from

jdbc:mysql://localhost:3306/Peoples

to

jdbc:mysql://localhost:3306/Peoples?autoReconnect=true&useSSL=false

as suggested in https://stackoverflow.com/a/34449182


Question: Is there some change that we can make to the execution environment of our new target (Ubuntu kernel version 5.4.0-91) such that we need not make changes to the existing Java code?

Sandeep
  • 1,245
  • 1
  • 13
  • 33

1 Answers1

0

You could resolve the SSL errors using the other method recommended in the error message itself:

You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.

(emphasis mine)

That is, create a truststore file, and set the path to the truststore file and the password using Java properties. Then you can set those properties without changing code.

See https://dev.mysql.com/doc/connector-j/8.0/en/connector-j-reference-using-ssl.html for more details on creating the truststore file and use properties to specify it to your Java app.

Bill Karwin
  • 538,548
  • 86
  • 673
  • 828