Database pooling- HikariCP - Too many connections and Failed to initialize pool error thrown

I have created a ‘Database pooling’ method in Java with HikariCP [ HikariCP » 2.5.1 version]. I have used ( jdk 1.7), Servlets, Tomcat Apache 7 and Mysql 5.5 version

I have Set ‘maximum connection’ in My SQL to 200

HikariConfig config = new HikariConfig();
config.setJdbcUrl(“jdbc:mysql://localhost/mytestdb”);
config.setDriverClassName(“com.mysql.jdbc.Driver”);
config.setUsername(“root”);
config.setPassword(“root”);
config.setPoolName(“MySQLPool”);
config.setMinimumIdle(2);
config.setMaximumPoolSize(5);
config.setAutoCommit(false);
config.addDataSourceProperty(“cachePrepStmts”, “true”);
config.addDataSourceProperty(“prepStmtCacheSize”, “250”);
config.addDataSourceProperty(“prepStmtCacheSqlLimit”, “2048”);
datasource = new HikariDataSource(config);

While saving from JSP page, sytstem throws ‘Failed to initialize’ the pool and “Too many connection” error thrown. Could some please help me to resolve this error ?

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.