Skip to content

Instantly share code, notes, and snippets.

@playerjamesbattleground
Created August 27, 2014 05:44
Show Gist options
  • Save playerjamesbattleground/cd124243286dd4c98c74 to your computer and use it in GitHub Desktop.
Save playerjamesbattleground/cd124243286dd4c98c74 to your computer and use it in GitHub Desktop.
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
<!-- access -->
<property name="driverClass" value="${db.driverclass}" />
<property name="jdbcUrl" value="${db.url}" />
<property name="user" value="${db.user}" />
<property name="password" value="${db.password}" />
<!-- pool sizing -->
<property name="initialPoolSize" value="3" />
<property name="minPoolSize" value="6" />
<property name="maxPoolSize" value="25" />
<property name="acquireIncrement" value="3" />
<property name="maxStatements" value="0" />
<!-- retries -->
<property name="acquireRetryAttempts" value="30" />
<property name="acquireRetryDelay" value="1000" /> <!-- 1s -->
<property name="breakAfterAcquireFailure" value="false" />
<!-- refreshing connections -->
<property name="maxIdleTime" value="180" /> <!-- 3min -->
<property name="maxConnectionAge" value="10" /> <!-- 1h -->
<!-- timeouts and testing -->
<property name="checkoutTimeout" value="5000" /> <!-- 5s -->
<property name="idleConnectionTestPeriod" value="60" /> <!-- 60 -->
<property name="testConnectionOnCheckout" value="true" />
<property name="preferredTestQuery" value="SELECT 1" />
<property name="testConnectionOnCheckin" value="true" />
</bean>
# DB settings
# ~~~~~~~~~~~~
# H2
db.driver = org.h2.Driver
db.url = jdbc:h2:mem:myDBname
db.user = sa
db.password =
# MySQL
#db.driver = com.mysql.jdbc.Driver
#db.url = jdbc:mysql://localhost:3306/myDBname
#db.user = mysql
#db.password = mysql
# PostegrSQL
#db.driver = org.postgresql.Driver
#db.url = jdbc:postgresql://localhost:5432/myDBname?searchpath=public
#db.user = postgresql
#db.password = postgresql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment