org.gbif.common.mybatis
Class C3P0DataSourceFactory
java.lang.Object
org.apache.ibatis.datasource.unpooled.UnpooledDataSourceFactory
org.gbif.common.mybatis.C3P0DataSourceFactory
- All Implemented Interfaces:
- org.apache.ibatis.datasource.DataSourceFactory
public class C3P0DataSourceFactory
- extends org.apache.ibatis.datasource.unpooled.UnpooledDataSourceFactory
A simple DataSourceFactory for MyBatis to create a connection pool using C3P0.
The properties to use in the MyBatis configuration are different from the included default pooled data source.
Make sure to specify at least:
- jdbcUrl
- driverClass (if it is not preloaded somehow)
But you usually also want:
A sample usage would look like this:
<dataSource type="org.gbif.common.mybatis.C3P0DataSourceFactory">
<property name="driverClass" value="org.postgresql.Driver"/>
<property name="jdbcUrl" value="${url}"/>
<property name="user" value="${username}"/>
<property name="password" value="${password}"/>
<property name="idleConnectionTestPeriod" value="60"/>
<property name="maxPoolSize" value="20"/>
<property name="maxIdleTime" value="600"/>
<property name="preferredTestQuery" value="SELECT 1"/>
</dataSource>
- See Also:
- C3P0 Configuration
| Fields inherited from class org.apache.ibatis.datasource.unpooled.UnpooledDataSourceFactory |
dataSource |
| Methods inherited from class org.apache.ibatis.datasource.unpooled.UnpooledDataSourceFactory |
getDataSource, setProperties |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
C3P0DataSourceFactory
public C3P0DataSourceFactory()
Copyright © 2012 Global Biodiversity Information Facility. All Rights Reserved.