Hi Alex,

----- Original Message -----
From: "Bates, Alex" <[EMAIL PROTECTED]>
To: "'OJB Users List'" <[EMAIL PROTECTED]>
Sent: Friday, August 29, 2003 10:31 PM
Subject: How to specify non-default DataSource for ODMG/PB api in
different scenarios?


> Hello,
>
> I'm using the ODMG/PB APIs in the following situations; in each I need
to be
> able to tell OJB to use a named DataSource (defined in
> repository_database.xml) other than the default.  Any help would be
> appreciated -
>

do you mean changing the used DataSource within
a transaction or only how to use multiple databases?

regards,
Armin

> --------------
>
>             Transaction tx = odmg.currentTransaction();
>             tx.lock(obj, Transaction.WRITE);
>
> --------------
>
>             db = odmg.getDatabase(null);
>             db.deletePersistent(obj);
>
> --------------
>
>             PersistenceBroker broker = ((HasBroker)
> odmg.currentTransaction()).getBroker();
>             Connection conn = null;
>             try {
>                 conn =
broker.serviceConnectionManager().getConnection();
>             } catch (LookupException e) {
>                 e.printStackTrace();
>             }
>
> --------------
>
>             // Must mark object as dirty to signal OJB to persist
>             Transaction tx = odmg.currentTransaction();
>             ((NarrowTransaction)tx).markDirty(obj);
>
> ---------------
>
>
> Thanks!
>
> Alex
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to