This one time, at band camp, Antje Rau said:
AR>i execute the following code:
AR>
AR>StartApplication.java:
AR>
AR> main:
AR> :
AR> db = jdo.getDatabase();
AR>
AR> :
AR> myObj.test(db);
AR>
AR> try {
AR> Thread.currentThread().sleep(1000);
AR> } catch (Exception e) {};
AR>
AR> myObj1.test(db);
AR>
AR> try {
AR> Thread.currentThread().sleep(1000);
AR> } catch (Exception e) {};
AR>
AR> myObj2.test(db);
AR>
AR> db.close();
AR>
AR>
AR>MyObject.java
AR>
AR> test (Database db):
AR>
AR> db.begin();
AR> :
AR> :
AR> db.commit();
AR>
AR>what i want is ONE connection to database for the whole three
AR>transactions, but when i observer the session list of my database
AR>(oracle) via toad i see 3 connections (one per transaction).
AR>then i try the following:
AR>- change the driver in database.xml to
AR>oracle.jdbc.pool.OracleConnectionCacheImpl
AR>- jdo.setDatabasePooling(true)
AR>but with no effects.
AR>what can i do ?
Antje,
Taken from the Javadocs:
http://www.castor.org/javadoc/org/exolab/castor/jdo/JDO.html#setDatabasePooling(boolean)
is a description of the functionality for this method:
'Enable/disable jdo Database pooling. This option only affects JDO if
transactionManager is set and a transaction is associated with the thread
that call getDatabase(). If jdo Database pooling is enabled, JDO will
first search in the pool to see if there is already a Database for the
current transaction. If found, it returns the database; if not, it create
a new one, associates it will the transaction and return the newly created
Database.'
If you would like a pool of database connections, please read the Pooling
Examples doc here:
http://www.castor.org/pooling.html
Regarding the specific behavior of the
oracle.jdbc.pool.OracleConnectionCacheImpl driver, there are parameters that
can be set to configure the connection pool. I'm no expert on the internals of
the Oracle JDBC drivers, however, something similar to the following has
worked fine for me:
<database name="oracle" engine="oracle" >
<driver url="jdbc:oracle:thin:@dbsrv3:1521:brnzorc"
class-name="oracle.jdbc.pool.OracleConnectionCacheImpl">
<param name="user" value="bsnyder" />
<param name="password" value="bsnyder" />
<param name="minLimit" value="2" />
<param name="maxLimit" value="10" />
<param name="cacheScheme" value="OracleConnectionCacheImpl.DYNAMIC_SCHEME" />
<param name="statementCacheSize" value="5" />
</driver>
<mapping href="mapping.xml" />
</database>
Bruce
--
perl -e 'print unpack("u30","<0G)U8V4\@4VYY9&5R\"F9E<G)E=\$\!F<FEI+F-O;0\`\`");'
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev