You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by Christopher Giblin <CG...@zurich.ibm.com> on 2009/08/18 04:51:50 UTC

openjpa, derby, pooled connections?

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


Re: openjpa, derby, pooled connections?

Posted by Kevin Sutter <kw...@gmail.com>.
Rick has also posted information on connection pooling with OpenJPA on this
blog entry:

http://webspherepersistence.blogspot.com/2009/01/jpa-connection-pooling.html

Kevin

On Wed, Aug 19, 2009 at 9:29 AM, Michael Dick <mi...@gmail.com>wrote:

>
> 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.
>

Re: openjpa, derby, pooled connections?

Posted by Michael Dick <mi...@gmail.com>.
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.