Craig-
We don't have any built-in connection pool in OpenJPA, and the
mechanism for using a 3rd party connection pool is woefully
underdocumented. If you want to use pooling, you can use Apache DBCP.
You can configure it using the following properties:
<property name="openjpa.ConnectionDriverName"
value="org.apache.commons.dbcp.BasicDataSource"/>
<property name="openjpa.ConnectionURL"
value="DriverClassName=org.apache.derby.jdbc.EmbeddedDriver,Url=jdbc:der
by://localhost:1527/
pbdb;create=true,MaxActive=100,MaxWait=10000,TestOnBorrow=true"/>
Alternatively, or in addition, you can also change how the OpenJPA
broker holds on to connections. By default, it will grab a connection
whenever it is needed, and then close it as quickly as possible. This
makes for efficient use of connections, but when there is no
connection pool involved, it can be cripplingly slow. It can be
changed using the "ConnectionRetainMode" property, which is described
at:
http://incubator.apache.org/openjpa/docs/latest/manual/
manual.html#ref_guide_dbsetup_retain
On Mar 15, 2007, at 4:59 PM, Craig L Russell wrote:
Hi,
Running 0.9.7 from March 7 (I think; someone else configured this).
Running very short transactions (createEM, begin, find one
instance, commit, close EM) I observe that connections are
constantly being acquired and then closed (hundreds of times per
second). Did I misconfigure the pool somehow?
These settings are in the persistence.xml,
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</
provider>
...
<property name="openjpa.ConnectionDriverName"
value="org.apache.derby.jdbc.ClientDriver"/>
<property name="openjpa.ConnectionURL"
value="jdbc:derby://localhost:1527/pbdb;create=true;"/>
<property name="openjpa.ConnectionUserName" value="ejb3"/>
<property name="openjpa.ConnectionPassword" value="ejb3"/>
<property name="openjpa.ConnectionRetainMode"
value="always"/>
<property name="openjpa.ConnectionFactoryProperties"
value="MaxActive=200,MaxIdle=200,MaxCachedStatements=250"/>
Thanks,
Craig
Craig Russell
DB PMC, OpenJPA PPMC
[EMAIL PROTECTED] http://db.apache.org/jdo