c3p0连接池连接mysql因版本异常 com.mchange.v2.resourcepool.TimeoutException

最近复习数据库连接池遇到mysql版本导致连接异常问题记录如下

环境:mysql版本:mysql8.0.25

        jar包版本:

        mysql驱动包:mysql-connector-java-8.0.11.jar

        c3p0连接池jar包:mchange-commons-java-0.2.12.jar  mysql-connector-java-8.0.11.jar

出现异常:

Exception in thread "main" java.sql.SQLException: An attempt by a client to checkout a Connection has timed out.
    at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:118)
    at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:77)
    at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:690)
    at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:140)
    at myStudy_jdbc.com.xiaoqiang.JDBCConnectionPool.c3p0DempMethod(JDBCConnectionPool.java:52)
    at myStudy_jdbc.com.xiaoqiang.JDBCConnectionPool.main(JDBCConnectionPool.java

你可能感兴趣的:(java笔记,java,数据库架构)