-
Notifications
You must be signed in to change notification settings - Fork 7
cn database c3p0
redraiment edited this page Jun 1, 2014
·
1 revision
除了URL
,jActiveRecord
还提供了通过javax.sql.DataSource
连接数据库的方法:
-
open(DataSource pool)
:试图建立到给定数据库连接池的连接。
因此,jActiveRecord
可以无缝地使用C3P0
等基于DataSource
的数据库连接池:
ComboPooledDataSource pool = new ComboPooledDataSource();
pool.setDriverClass("org.postgresql.Driver");
pool.setJdbcUrl("jdbc:postgresql:test");
pool.setUser("postgres");
pool.setPassword("password");
pool.setMinPoolSize(20);
pool.setMaxPoolSize(120);
pool.setAcquireIncrement(10);
DB dbo = DB.open(pool);
// Todo
pool.close();
- 博客:zzp.me
- 微博:@redraiment