Hi Gaurav,
I don't know which version you use, so all comments
made for current version 0.9.8
----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
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:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
>
>
>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>