You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Ga...@ercgroup.com on 2002/12/25 02:26:31 UTC

PersitenceBroker & Conn Pooling

Hi,
	I'm not sure about how the PersitenceBroker manages database
connections.
	My understanding is that a PersitenceBrokerFactory creates a new
PersitenceBroker which stores the DB connection when a call is made to
defaultPersistenceBroker() based on information in repository.xml and this
connection is closed when a call is made to PersitenceBroker.close().
	Is this correct?
	If yes, what should an application do for connection pooling? Should
defaultPersistenceBroker() be called multiple times during application start
up and then store those PersitenceBrokers in a pool?
	If the application has its own mechanism of connection pooling (e.g.
DBCP), then can PersitenceBrokers be created using the database connections
from the application's pool.

Thanks,
Gaurav

Re: PersitenceBroker & Conn Pooling

Posted by Armin Waibel <ar...@code-au-lait.de>.
Hi Gaurav,

I don't know which version you use, so all comments
made for current version 0.9.8


----- Original Message -----
From: <Ga...@ercgroup.com>
To: <oj...@jakarta.apache.org>
Sent: Wednesday, December 25, 2002 2:26 AM
Subject: PersitenceBroker & Conn Pooling


> Hi,
> I'm not sure about how the PersitenceBroker manages database
> connections.
> My understanding is that a PersitenceBrokerFactory creates a new
> PersitenceBroker
yes, PBF obtain a PB from the PB-pool.

>which stores the DB connection when a call is made to
> defaultPersistenceBroker() based on information in repository.xml
Not correct, the PB instance obtain a connection when
PB.beginTransaction()
was called.

> and this
> connection is closed when a call is made to PersitenceBroker.close().
> Is this correct?
Not correct, the connection was closed when PB.commitTransaction()
or PB.abortTransaction() was called.

> If yes, what should an application do for connection pooling?Should
> defaultPersistenceBroker() be called multiple times during application
start
> up and then store those PersitenceBrokers in a pool?
All connection pooling was done by OJB.
There was a PB pool, pooling
the PB instances (see OJB.properties file section
PersistenceBrokerFactory pool) and there were several
implementations of ConnectionFactory in a position to do
connection pooling (see OJB.properties file section
'ConnectionFactory / Default ConnectionPool' for more information.

> If the application has its own mechanism of connection pooling (e.g.
> DBCP), then can PersitenceBrokers be created using the database
connections
> from the application's pool.
When your application has it's own connection pooling mechanism, there
are two ways to use this:

1. When your pool supports Datasources/JNDI, declare OJB to obtain
connections via JNDI lookup. None of the OJB ConnectionFactory
implementations does pool Datasource.
Your jdbc-connection-descriptor looks like that
<jdbc-connection-descriptor
     platform="Hsqldb"
     jdbc-level="2.0"
     jndi-datasource-name="java:DefaultDS"
     username="sa"
     password=""
  />

2. If your application does not support Datasources/JNDI
you have to write your own implementation of
ConnectionFactory to support your specific connection pool.

By the way OJB was shipped with a DBCP-ConnectionFactory
implementation.

regards,
Armin

>
> Thanks,
> Gaurav
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>
>