连接池有C3P0、DBCP
使用方法:
HikariConfig config = new HikariConfig();
config.setMaximumPoolSize(100);
config.setDataSourceClassName("com.mysql.jdbc.jdbc2.optional.MysqlDataSource");
config.addDataSourceProperty("serverName", "localhost");
config.addDataSourceProperty("port", "3306");
config.addDataSourceProperty("databaseName", "mydb");
config.addDataSourceProperty("user", "bart");
config.addDataSourceProperty("password", "51mp50n");
HikariDataSource ds = new HikariDataSource(config);
Maven:
<dependency> <groupId>com.zaxxer</groupId> <artifactId>HikariCP</artifactId> <version>1.3.5</version> <scope>compile</scope> </dependency>