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 Jem McCombe <su...@indigohosting.net> on 2003/03/22 11:11:34 UTC
WebLogic CMP versus OJB?
Hi,
We're looking to use OJB v1.0 as our persistence engine in a new
high-throughput *clustered* Weblogic 7 application.
Does anyone have any pros/cons of using OJB against a straight WL CMP
implementation? How does the performance compare? Any gotchas to beware of
using OJB in a clustered WL environment (things like sequence id management
etc)?
Many thanks!
Jem
Re: Connection Pool
Posted by Armin Waibel <ar...@code-au-lait.de>.
Hi Jakob,
this test try to exhaust the connection pool, per default the pool
size is 21. When the pool exhaust a PersistenceBrokerException
results, if so the test is passed.
Think the default size of active connections in most databases
is 10, maybe I should decrease the OJB connection pool size.
I will check in new version soon.
regards,
Armin
----- Original Message -----
From: "Jakob Braeuchi" <jb...@gmx.ch>
To: "OJB Users List" <oj...@db.apache.org>; "Armin Waibel"
<ar...@code-au-lait.de>
Sent: Saturday, May 10, 2003 11:01 AM
Subject: Re: Connection Pool
> hi armin,
>
> i just ran the ojb test-suite for pb-api and came accross this
'pooling
> problem' when using mysql.
> the same connection descriptor with hsqldb works for me.
>
> jakob
>
> rethrown as org.apache.ojb.broker.accesslayer.LookupException: Could
not
> borrow connection from pool -
> org.apache.ojb.broker.metadata.JdbcConnectionDescriptor:
> org.apache.ojb.broker.metadata.JdbcConnectionDescriptor@1bd7848[
> jcd-alias=default
> default-connection=true
> dbms=MySQL
> jdbc-level=2.0
> driver=com.p6spy.engine.spy.P6SpyDriver
> protocol=jdbc
> sub-protocol=mysql
> db-alias=//localhost:3306/ojb
> user=sa
> password=*****
> eager-release=false
> ConnectionPoolDescriptor={whenExhaustedAction=0, maxIdle=-1,
> maxActive=21, maxWait=5000, removeAbandoned=false,
> numTestsPerEvictionRun=10, testWhileIdle=false,
> minEvictableIdleTimeMillis=600000, testOnReturn=false,
> logAbandoned=false, removeAbandonedTimeout=300,
> timeBetweenEvictionRunsMillis=-1, testOnBorrow=true}
> batchMode=false
> useAutoCommit=AUTO_COMMIT_SET_TRUE_AND_TEMPORARY_FALSE
> ignoreAutoCommitExceptions=false
>
>
sequenceDescriptor=org.apache.ojb.broker.metadata.SequenceDescriptor@1e7
8fc6[
> sequenceManagerClass=class
> org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl
> Properties={autoNaming=true, globalSequenceId=false,
> globalSequenceStart=10000, grabSize=20}
> ]
> ]
> at
>
org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl.getConnect
ionFromPool(ConnectionFactoryPooledImpl.java:69)
> at
>
org.apache.ojb.broker.accesslayer.ConnectionFactoryAbstractImpl.lookupCo
nnection(ConnectionFactoryAbstractImpl.java:101)
> at
>
org.apache.ojb.broker.accesslayer.ConnectionManagerImpl.getConnection(Co
nnectionManagerImpl.java:129)
> at
>
org.apache.ojb.broker.accesslayer.StatementManager.getPreparedStatement(
StatementManager.java:673)
> at
>
org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeQuery(JdbcAccess
Impl.java:257)
> at
>
org.apache.ojb.broker.accesslayer.RsIterator.<init>(RsIterator.java:199)
> at
>
org.apache.ojb.broker.core.RsIteratorFactoryImpl.createRsIterator(RsIter
atorFactoryImpl.java:95)
> at
>
org.apache.ojb.broker.core.PersistenceBrokerImpl.getRsIteratorFromQuery(
PersistenceBrokerImpl.java:2310)
> at
>
org.apache.ojb.broker.core.PersistenceBrokerImpl.getIteratorFromQuery(Pe
rsistenceBrokerImpl.java:1656)
> at
>
org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Pe
rsistenceBrokerImpl.java:1305)
> at
>
org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Pe
rsistenceBrokerImpl.java:1459)
> at
>
org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Pe
rsistenceBrokerImpl.java:1495)
> at
>
org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Pe
rsistenceBrokerImpl.java:1484)
> at
>
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQu
ery(DelegatingPersistenceBroker.java:302)
> at
>
org.apache.ojb.broker.ConnectionFactoryTest.doSampleQuery(ConnectionFact
oryTest.java:219)
> at
>
org.apache.ojb.broker.ConnectionFactoryTest.testExhaustedPool2(Connectio
nFactoryTest.java:192)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
>
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
> at
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:324)
> at junit.framework.TestCase.runTest(TestCase.java:154)
> at junit.framework.TestCase.runBare(TestCase.java:127)
> at junit.framework.TestResult$1.protect(TestResult.java:106)
> at junit.framework.TestResult.runProtected(TestResult.java:124)
> at junit.framework.TestResult.run(TestResult.java:109)
> at junit.framework.TestCase.run(TestCase.java:118)
> at junit.framework.TestSuite.runTest(TestSuite.java:208)
> at junit.framework.TestSuite.run(TestSuite.java:203)
> at junit.framework.TestSuite.runTest(TestSuite.java:208)
> at junit.framework.TestSuite.run(TestSuite.java:203)
> at junit.textui.TestRunner.doRun(TestRunner.java:116)
> at junit.textui.TestRunner.start(TestRunner.java:172)
> at junit.textui.TestRunner.main(TestRunner.java:138)
> at org.apache.ojb.broker.AllTests.main(AllTests.java:31)
> Caused by: java.util.NoSuchElementException
> at
>
org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjec
tPool.java:720)
> at
>
org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl.getConnect
ionFromPool(ConnectionFactoryPooledImpl.java:65)
> ... 33 more
>
>
> Armin Waibel wrote:
>
> >Hi Michael,
> >
> >----- Original Message -----
> >From: "Michael Buchsbaum" <mi...@snapu.com>
> >To: "OJB Users List" <oj...@db.apache.org>
> >Sent: Saturday, March 22, 2003 2:08 PM
> >Subject: Connection Pool
> >
> >
> >
> >
> >>Has anyone had any problem with the connection pool crashing when
> >>
> >>
> >doing
> >
> >
> >>large updates with relationships?
> >>
> >>
> >
> >AFAIK you are the first.
> >
> >
> >
> >>I'm using MySQL. I get the error message
> >>"Borrow broker from pool failed"
> >>
> >>
> >
> >Not the connection pool, the PersistenceBroker pool
> >crashed.
> >When using the PB-api, do you close the
> >broker after use?
> >
> >e.g.
> >PersistenceBroker broker;
> >{
> >broker = PersistenceBrokerFactory.createPersistenceBroker(myPBKey);
> >...
> >do something
> >....
> >}
> >finally
> >{
> >// return broker instance to pool
> >if(broker != null) broker.close();
> >}
> >
> >This isn't the problem? Then some more
> >details would be useful.
> >
> >regards,
> >Armin
> >
> >
> >>Thanks
> >>Michael
> >>
> >>
>
>>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> >>For additional commands, e-mail: ojb-user-help@db.apache.org
> >>
> >>
> >>
> >>
> >>
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> >For additional commands, e-mail: ojb-user-help@db.apache.org
> >
> >
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
>
Re: Connection Pool
Posted by Jakob Braeuchi <jb...@gmx.ch>.
hi armin,
i just ran the ojb test-suite for pb-api and came accross this 'pooling
problem' when using mysql.
the same connection descriptor with hsqldb works for me.
jakob
rethrown as org.apache.ojb.broker.accesslayer.LookupException: Could not
borrow connection from pool -
org.apache.ojb.broker.metadata.JdbcConnectionDescriptor:
org.apache.ojb.broker.metadata.JdbcConnectionDescriptor@1bd7848[
jcd-alias=default
default-connection=true
dbms=MySQL
jdbc-level=2.0
driver=com.p6spy.engine.spy.P6SpyDriver
protocol=jdbc
sub-protocol=mysql
db-alias=//localhost:3306/ojb
user=sa
password=*****
eager-release=false
ConnectionPoolDescriptor={whenExhaustedAction=0, maxIdle=-1,
maxActive=21, maxWait=5000, removeAbandoned=false,
numTestsPerEvictionRun=10, testWhileIdle=false,
minEvictableIdleTimeMillis=600000, testOnReturn=false,
logAbandoned=false, removeAbandonedTimeout=300,
timeBetweenEvictionRunsMillis=-1, testOnBorrow=true}
batchMode=false
useAutoCommit=AUTO_COMMIT_SET_TRUE_AND_TEMPORARY_FALSE
ignoreAutoCommitExceptions=false
sequenceDescriptor=org.apache.ojb.broker.metadata.SequenceDescriptor@1e78fc6[
sequenceManagerClass=class
org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl
Properties={autoNaming=true, globalSequenceId=false,
globalSequenceStart=10000, grabSize=20}
]
]
at
org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl.getConnectionFromPool(ConnectionFactoryPooledImpl.java:69)
at
org.apache.ojb.broker.accesslayer.ConnectionFactoryAbstractImpl.lookupConnection(ConnectionFactoryAbstractImpl.java:101)
at
org.apache.ojb.broker.accesslayer.ConnectionManagerImpl.getConnection(ConnectionManagerImpl.java:129)
at
org.apache.ojb.broker.accesslayer.StatementManager.getPreparedStatement(StatementManager.java:673)
at
org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeQuery(JdbcAccessImpl.java:257)
at
org.apache.ojb.broker.accesslayer.RsIterator.<init>(RsIterator.java:199)
at
org.apache.ojb.broker.core.RsIteratorFactoryImpl.createRsIterator(RsIteratorFactoryImpl.java:95)
at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getRsIteratorFromQuery(PersistenceBrokerImpl.java:2310)
at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getIteratorFromQuery(PersistenceBrokerImpl.java:1656)
at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(PersistenceBrokerImpl.java:1305)
at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(PersistenceBrokerImpl.java:1459)
at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(PersistenceBrokerImpl.java:1495)
at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(PersistenceBrokerImpl.java:1484)
at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(DelegatingPersistenceBroker.java:302)
at
org.apache.ojb.broker.ConnectionFactoryTest.doSampleQuery(ConnectionFactoryTest.java:219)
at
org.apache.ojb.broker.ConnectionFactoryTest.testExhaustedPool2(ConnectionFactoryTest.java:192)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at junit.textui.TestRunner.doRun(TestRunner.java:116)
at junit.textui.TestRunner.start(TestRunner.java:172)
at junit.textui.TestRunner.main(TestRunner.java:138)
at org.apache.ojb.broker.AllTests.main(AllTests.java:31)
Caused by: java.util.NoSuchElementException
at
org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:720)
at
org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl.getConnectionFromPool(ConnectionFactoryPooledImpl.java:65)
... 33 more
Armin Waibel wrote:
>Hi Michael,
>
>----- Original Message -----
>From: "Michael Buchsbaum" <mi...@snapu.com>
>To: "OJB Users List" <oj...@db.apache.org>
>Sent: Saturday, March 22, 2003 2:08 PM
>Subject: Connection Pool
>
>
>
>
>>Has anyone had any problem with the connection pool crashing when
>>
>>
>doing
>
>
>>large updates with relationships?
>>
>>
>
>AFAIK you are the first.
>
>
>
>>I'm using MySQL. I get the error message
>>"Borrow broker from pool failed"
>>
>>
>
>Not the connection pool, the PersistenceBroker pool
>crashed.
>When using the PB-api, do you close the
>broker after use?
>
>e.g.
>PersistenceBroker broker;
>{
>broker = PersistenceBrokerFactory.createPersistenceBroker(myPBKey);
>...
>do something
>....
>}
>finally
>{
>// return broker instance to pool
>if(broker != null) broker.close();
>}
>
>This isn't the problem? Then some more
>details would be useful.
>
>regards,
>Armin
>
>
>>Thanks
>>Michael
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>>For additional commands, e-mail: ojb-user-help@db.apache.org
>>
>>
>>
>>
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
>
>
Re: Connection Pool
Posted by Thomas Phan <tw...@entersys.com>.
Hi Armin and Micheal,
I'm using ODMG in the same way as Micheal. I had this problem before too,
not sure if I'm still getting this now (using OJB 0.9.9)
In OJB 0.9.5/6 (not remember exactly), if I did a lot of updates at a very
short period of time, I found that the PB crashed very easily once an
exception was thrown within a transaction, then being catched, and rollback.
After getting a few exceptions in the same place, the log (log4j) told the
number of PB instances were increased quickly, like it increased per each
new request. I guess that the old PB instance might take some resource and
blocked, and the deadlock might occurred! The situation got better as I
debugged my code to avoid those exceptions. I don't remember what were those
exceptions in details, may be Micheal faces something similar now
Wonder how does OJB determine to create an extra instance?
Thomas
----- Original Message -----
From: "Armin Waibel" <ar...@code-au-lait.de>
To: "OJB Users List" <oj...@db.apache.org>
Sent: Sunday, March 23, 2003 1:51 AM
Subject: Re: Connection Pool
> Hi Michael,
>
> seems ok for me.
> When do you get the broker pool crash,
> how many threads do access your singleton?
>
> Which version do you use?
>
> Do increase the broker pool size in OJB.properties file?
>
> regards,
> Armin
>
> > I'm actually using ODMG. Maybe I'm not using it properly. I have one
> > service class that does all the OJB work. In that class I do
> something
> > like this in the constructor:
> >
> > odmg = OJB.getInstance();
> > Database db = odmg.newDatabase();
> >
> > try {
> > db.open("default", Database.OPEN_READ_WRITE);
> > } catch (ODMGException e) {
> > e.printStackTrace();
> > }
> >
> > The class is a singleton. Then in each method (let's say for updates)
> I
> > do something like this:
> >
> > Transaction tx = null;
> > try {
> > tx = odmg.newTransaction();
> > tx.begin();
> >
> > ... some work
> >
> > tx.commit();
> > } finally {
> > tx.rollback();
> > }
> >
> > Am I doing that correctly? Should I not be using ODMG? Any help is
> > appreciated.
> >
> > Thanks
> > Michael
> >
> >
> > -----Original Message-----
> > From: Armin Waibel [mailto:armin.waibel@code-au-lait.de]
> > Sent: Saturday, March 22, 2003 9:47 AM
> > To: OJB Users List
> > Subject: Re: Connection Pool
> >
> > Hi Michael,
> >
> > ----- Original Message -----
> > From: "Michael Buchsbaum" <mi...@snapu.com>
> > To: "OJB Users List" <oj...@db.apache.org>
> > Sent: Saturday, March 22, 2003 2:08 PM
> > Subject: Connection Pool
> >
> >
> > > Has anyone had any problem with the connection pool crashing when
> > doing
> > > large updates with relationships?
> >
> > AFAIK you are the first.
> >
> > > I'm using MySQL. I get the error message
> > > "Borrow broker from pool failed"
> >
> > Not the connection pool, the PersistenceBroker pool
> > crashed.
> > When using the PB-api, do you close the
> > broker after use?
> >
> > e.g.
> > PersistenceBroker broker;
> > {
> > broker = PersistenceBrokerFactory.createPersistenceBroker(myPBKey);
> > ...
> > do something
> > ....
> > }
> > finally
> > {
> > // return broker instance to pool
> > if(broker != null) broker.close();
> > }
> >
> > This isn't the problem? Then some more
> > details would be useful.
> >
> > regards,
> > Armin
> > >
> > > Thanks
> > > Michael
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> > > For additional commands, e-mail: ojb-user-help@db.apache.org
> > >
> > >
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> > For additional commands, e-mail: ojb-user-help@db.apache.org
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> > For additional commands, e-mail: ojb-user-help@db.apache.org
> >
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
RE: Connection Pool
Posted by Michael Buchsbaum <mi...@snapu.com>.
Hi,
It's really only one thread that is accessing the singleton right now -
it may be more later. I am using version 0.9.9
I'll try to increase the size in the OJB.properties file. Could it be
that I don't have my repository.xml set up properly? Do you have a
sample of what it might look like for MySQL?
I get the broker crash when I try to make an update where there is a m:n
mapping between two tables.
Michael Buchsbaum
Snapu Technology Corporation
917-331-7838
-----Original Message-----
From: Armin Waibel [mailto:armin.waibel@code-au-lait.de]
Sent: Saturday, March 22, 2003 12:52 PM
To: OJB Users List
Subject: Re: Connection Pool
Hi Michael,
seems ok for me.
When do you get the broker pool crash,
how many threads do access your singleton?
Which version do you use?
Do increase the broker pool size in OJB.properties file?
regards,
Armin
> I'm actually using ODMG. Maybe I'm not using it properly. I have one
> service class that does all the OJB work. In that class I do
something
> like this in the constructor:
>
> odmg = OJB.getInstance();
> Database db = odmg.newDatabase();
>
> try {
> db.open("default", Database.OPEN_READ_WRITE);
> } catch (ODMGException e) {
> e.printStackTrace();
> }
>
> The class is a singleton. Then in each method (let's say for updates)
I
> do something like this:
>
> Transaction tx = null;
> try {
> tx = odmg.newTransaction();
> tx.begin();
>
> ... some work
>
> tx.commit();
> } finally {
> tx.rollback();
> }
>
> Am I doing that correctly? Should I not be using ODMG? Any help is
> appreciated.
>
> Thanks
> Michael
>
>
> -----Original Message-----
> From: Armin Waibel [mailto:armin.waibel@code-au-lait.de]
> Sent: Saturday, March 22, 2003 9:47 AM
> To: OJB Users List
> Subject: Re: Connection Pool
>
> Hi Michael,
>
> ----- Original Message -----
> From: "Michael Buchsbaum" <mi...@snapu.com>
> To: "OJB Users List" <oj...@db.apache.org>
> Sent: Saturday, March 22, 2003 2:08 PM
> Subject: Connection Pool
>
>
> > Has anyone had any problem with the connection pool crashing when
> doing
> > large updates with relationships?
>
> AFAIK you are the first.
>
> > I'm using MySQL. I get the error message
> > "Borrow broker from pool failed"
>
> Not the connection pool, the PersistenceBroker pool
> crashed.
> When using the PB-api, do you close the
> broker after use?
>
> e.g.
> PersistenceBroker broker;
> {
> broker = PersistenceBrokerFactory.createPersistenceBroker(myPBKey);
> ...
> do something
> ....
> }
> finally
> {
> // return broker instance to pool
> if(broker != null) broker.close();
> }
>
> This isn't the problem? Then some more
> details would be useful.
>
> regards,
> Armin
> >
> > Thanks
> > Michael
> >
> >
>
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> > For additional commands, e-mail: ojb-user-help@db.apache.org
> >
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: Connection Pool
Posted by Armin Waibel <ar...@code-au-lait.de>.
Hi Michael,
seems ok for me.
When do you get the broker pool crash,
how many threads do access your singleton?
Which version do you use?
Do increase the broker pool size in OJB.properties file?
regards,
Armin
> I'm actually using ODMG. Maybe I'm not using it properly. I have one
> service class that does all the OJB work. In that class I do
something
> like this in the constructor:
>
> odmg = OJB.getInstance();
> Database db = odmg.newDatabase();
>
> try {
> db.open("default", Database.OPEN_READ_WRITE);
> } catch (ODMGException e) {
> e.printStackTrace();
> }
>
> The class is a singleton. Then in each method (let's say for updates)
I
> do something like this:
>
> Transaction tx = null;
> try {
> tx = odmg.newTransaction();
> tx.begin();
>
> ... some work
>
> tx.commit();
> } finally {
> tx.rollback();
> }
>
> Am I doing that correctly? Should I not be using ODMG? Any help is
> appreciated.
>
> Thanks
> Michael
>
>
> -----Original Message-----
> From: Armin Waibel [mailto:armin.waibel@code-au-lait.de]
> Sent: Saturday, March 22, 2003 9:47 AM
> To: OJB Users List
> Subject: Re: Connection Pool
>
> Hi Michael,
>
> ----- Original Message -----
> From: "Michael Buchsbaum" <mi...@snapu.com>
> To: "OJB Users List" <oj...@db.apache.org>
> Sent: Saturday, March 22, 2003 2:08 PM
> Subject: Connection Pool
>
>
> > Has anyone had any problem with the connection pool crashing when
> doing
> > large updates with relationships?
>
> AFAIK you are the first.
>
> > I'm using MySQL. I get the error message
> > "Borrow broker from pool failed"
>
> Not the connection pool, the PersistenceBroker pool
> crashed.
> When using the PB-api, do you close the
> broker after use?
>
> e.g.
> PersistenceBroker broker;
> {
> broker = PersistenceBrokerFactory.createPersistenceBroker(myPBKey);
> ...
> do something
> ....
> }
> finally
> {
> // return broker instance to pool
> if(broker != null) broker.close();
> }
>
> This isn't the problem? Then some more
> details would be useful.
>
> regards,
> Armin
> >
> > Thanks
> > Michael
> >
> >
>
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> > For additional commands, e-mail: ojb-user-help@db.apache.org
> >
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
>
RE: Connection Pool
Posted by Michael Buchsbaum <mi...@snapu.com>.
Armin,
Thanks for getting back to me.
I'm actually using ODMG. Maybe I'm not using it properly. I have one
service class that does all the OJB work. In that class I do something
like this in the constructor:
odmg = OJB.getInstance();
Database db = odmg.newDatabase();
try {
db.open("default", Database.OPEN_READ_WRITE);
} catch (ODMGException e) {
e.printStackTrace();
}
The class is a singleton. Then in each method (let's say for updates) I
do something like this:
Transaction tx = null;
try {
tx = odmg.newTransaction();
tx.begin();
... some work
tx.commit();
} finally {
tx.rollback();
}
Am I doing that correctly? Should I not be using ODMG? Any help is
appreciated.
Thanks
Michael
-----Original Message-----
From: Armin Waibel [mailto:armin.waibel@code-au-lait.de]
Sent: Saturday, March 22, 2003 9:47 AM
To: OJB Users List
Subject: Re: Connection Pool
Hi Michael,
----- Original Message -----
From: "Michael Buchsbaum" <mi...@snapu.com>
To: "OJB Users List" <oj...@db.apache.org>
Sent: Saturday, March 22, 2003 2:08 PM
Subject: Connection Pool
> Has anyone had any problem with the connection pool crashing when
doing
> large updates with relationships?
AFAIK you are the first.
> I'm using MySQL. I get the error message
> "Borrow broker from pool failed"
Not the connection pool, the PersistenceBroker pool
crashed.
When using the PB-api, do you close the
broker after use?
e.g.
PersistenceBroker broker;
{
broker = PersistenceBrokerFactory.createPersistenceBroker(myPBKey);
...
do something
....
}
finally
{
// return broker instance to pool
if(broker != null) broker.close();
}
This isn't the problem? Then some more
details would be useful.
regards,
Armin
>
> Thanks
> Michael
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: Connection Pool
Posted by Armin Waibel <ar...@code-au-lait.de>.
Hi Michael,
----- Original Message -----
From: "Michael Buchsbaum" <mi...@snapu.com>
To: "OJB Users List" <oj...@db.apache.org>
Sent: Saturday, March 22, 2003 2:08 PM
Subject: Connection Pool
> Has anyone had any problem with the connection pool crashing when
doing
> large updates with relationships?
AFAIK you are the first.
> I'm using MySQL. I get the error message
> "Borrow broker from pool failed"
Not the connection pool, the PersistenceBroker pool
crashed.
When using the PB-api, do you close the
broker after use?
e.g.
PersistenceBroker broker;
{
broker = PersistenceBrokerFactory.createPersistenceBroker(myPBKey);
...
do something
....
}
finally
{
// return broker instance to pool
if(broker != null) broker.close();
}
This isn't the problem? Then some more
details would be useful.
regards,
Armin
>
> Thanks
> Michael
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
>
Connection Pool
Posted by Michael Buchsbaum <mi...@snapu.com>.
Has anyone had any problem with the connection pool crashing when doing
large updates with relationships? I'm using MySQL. I get the error message
"Borrow broker from pool failed"
Thanks
Michael