Last active
March 14, 2019 17:22
-
-
Save rafaeltuelho/4c728ca0a8c5acc66155 to your computer and use it in GitHub Desktop.
JBoss Fuse: JDBC Datasource with Connection Pooling with Apache commons-dbcp2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- add this snippet to your XML/Blueprint --> | |
<!-- Oracle --> | |
<bean id="oracleDataSource" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close"> | |
<property name="driverClassName" value="${db.driver}" /> | |
<property name="url" value="${db.url}" /> | |
<property name="username" value="${db.username}" /> | |
<property name="password" value="${db.password}" /> | |
<property name="initialSize" value="${db.pool.min}" /> | |
<property name="maxTotal" value="${db.pool.max}" /> | |
<property name="maxIdle" value="${db.pool.min}" /> | |
<property name="maxWaitMillis" value="5000" /> | |
</bean> | |
<!-- Derby embedded mode (for testing puposes) --> | |
<!-- this is the JDBC data source which uses an in-memory only Apache Derby database --> | |
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> | |
<property name="driverClassName" value="org.apache.derby.jdbc.EmbeddedDriver"/> | |
<property name="url" value="jdbc:derby:memory:orders;create=true"/> | |
<property name="username" value=""/> | |
<property name="password" value=""/> | |
</bean> | |
<!-- H2 SQL DB (localhost) --> | |
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> | |
<property name="driverClassName" value="org.h2.Driver"/> | |
<property name="url" value="jdbc:h2:tcp://localhost/~/var/h2db/test"/> | |
<property name="username" value="sa"/> | |
<property name="password" value="sa"/> | |
</bean> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
remember to add the commons-dbcp2 dependency in your Fuse project profile. The commons-dbcp2 is OSGI friendly already.