openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Dick <michael.d.d...@gmail.com>
Subject Re: openjpa, derby, pooled connections?
Date Wed, 19 Aug 2009 14:29:34 GMT

Hi Chris,

OpenJPA does not include a connection pool, so you'll need to plug in a
third party pool like commons-dbcp. 

We use commons-dbcp fairly extensively in our unit tests and it can be
configured similarly to a direct connection to the database. 

For example to use derby add these properties to persistence.xml: 
<property name="openjpa.ConnectionDriverName"
value="org.apache.commons.dbcp.BasicDataSource"/>
<property name="openjpa.ConnectionProperties"
value="DriverClassName=org.apache.derby.jdbc.EmbeddedDriver,Url=jdbc:derby:target/database/openjpa-test-database;create=true"/>

org.apache.commons.dbcp.BasicDataSource is the datasource, and you specify
the rest of the connection information as ConnectionProperties -
commons-dbcp will handle the rest. 

The configuration for DB2 will be pretty similar but you'll need to include
a username and password. 

Hope this helps,
-mike


Christopher Giblin wrote:
> 
> 
> Hi,
> I am developing an Eclipse RCP app with OpenJPA. That is, Java SE, not
> Java
> EE.
> I would like to enable connection pooling and have questions regarding
> Derby and DB2:
> 
> 1) Has anyone a OpenJPA config example for DB2 and connection pooling?
> 
> 2) Is the only way to enable JDBC connection pooling for OpenJPA with a
> Derby database by means of Apache DBCP? Is Derby connection pooling
> possible only through a third-party connection pool?
> 
> Thanks,
> chris
> 
> 
> 

-- 
View this message in context: http://n2.nabble.com/openjpa%2C-derby%2C-pooled-connections--tp3463682p3472622.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Mime
View raw message