MySQL Connectivity Common Errors


MySQL-Error
In this post, I'll discuss some of the common errors being encountered during connection with MySQL Server and the best possible solution worked for me or someone-

Problem-1
JDBC Connection Failure
java.sql.SQLNonTransientConnectionException: Could not create connection to database server. Attempted to reconnect 3 times. Giving up 
Solution
Change JDBC url to include character encoding-
jdbc:mysql://localhost:3306/databaseName?useUnicode=true&characterEncoding=utf8&useSSL=false&useLegacyDatetimeCode=false&noAccessToProcedureBodies=true&serverTimezone=UTC

Problem-2
Connection Java-MySql: Public Key Retrieval is not allowed
Exception in thread "main" java.sql.SQLNonTransientConnectionException: Public Key Retrieval is not allowed
Solution
Change JDBC URL to include alllow Public Key Retrival true-
jdbc:mysql://localhost:3306/databaseName?allowPublicKeyRetrieval=true&useSSL=false;
Ref- https://mysqlconnector.net/connection-options/

Comments

Popular posts from this blog

Oracle SOA Suite- Implementing Email Notification

Oracle SOA Suite 12c- PKIX path building failed & unable to find valid certification path to requested target

Migration of Oracle SOA Suite Composite from 11g to 12c