HikariCP logoJDBC 连接池 HikariCP

HikariCP 是一个高性能的 JDBC 连接池组件。

使用方法:

?
1
2
3
4
5
6
7
8
9
10
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);

或者:

?
1
2
3
4
5
6
7
8
9
10
11
/**
connectionTestQuery=SELECT 1
dataSourceClassName=org.postgresql.ds.PGSimpleDataSource
dataSource.user=test
dataSource.password=test
dataSource.databaseName=mydb
dataSource.serverName=localhost
*/
 
HikariConfig config =  new  HikariConfig( "some/path/hikari.properties" );
HikariDataSource ds =  new  HikariDataSource(config);

Maven:

?
1
2
3
4
5
6

Java 7 and Java 8 maven artifact:


    com.zaxxer
    HikariCP
    2.4.5
    compile

Java 6 maven artifact:


    com.zaxxer
    HikariCP-java6
    2.3.13
    compile


你可能感兴趣的:(java,mySql)