java.sql.SQLException:连接太多

时间:2018-11-28 15:12:59

标签: java mariadb

在Gitlarunner上但不在本地运行测试时出现此错误,这是实现与mariadb的连接的代码

mariadb中的max_connection设置为100,我认为足够了吗?

您看到我的实施中有任何缺陷吗?

config.addDataSourceProperty("dataSource.prepStmtCacheSqlLimit", "2048");
        config.addDataSourceProperty("dataSource.useServerPrepStmts", "true");
        return new HikariDataSource(config);
    }

2018-11-28 14:49:31 UTC WARN  HikariConfig:881 - rest-connection-pool - idleTimeout is close to or more than maxLifetime, disabling it.
2018-11-28 14:49:31 UTC INFO  HikariDataSource:71 - rest-connection-pool - Starting...
2018-11-28 14:49:31 UTC INFO  HikariDataSource:73 - rest-connection-pool - Start completed.
2018-11-28 14:49:32 UTC INFO  StorageDataConfig:41 - Database username: root
2018-11-28 14:49:32 UTC INFO  StorageDataConfig:42 - Database password in use: No
2018-11-28 14:49:32 UTC INFO  StorageDataConfig:43 - Database URL: jdbc:mysql://localhost/storage?createDatabaseIfNotExist=true&useLegacyDatetimeCode=false&serverTimezone=UTC
2018-11-28 14:49:32 UTC INFO  HikariDataSource:71 - storage-connection-pool - Starting...
2018-11-28 14:49:33 UTC ERROR HikariPool:541 - storage-connection-pool - Exception during pool initialization.
java.sql.SQLException: Too many connections
    at org.mariadb.jdbc.internal.com.read.ReadInitialHandShakePacket.<init>(ReadInitialHandShakePacket.java:91)
    at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.handleConnectionPhases(AbstractConnectProtocol.java:716)
    at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.connect(AbstractConnectProtocol.java:454)
    at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.connectWithoutProxy(AbstractConnectProtocol.java:1089)
    at org.mariadb.jdbc.internal.util.Utils.retrieveProxy(Utils.java:494)
    at org.mariadb.jdbc.MariaDbConnection.newConnection(MariaDbConnection.java:150)

错误:

GET https://jedrekdomanski.github.io/bikeramp-front/ 404 ()

0 个答案:

没有答案