Hi Alex,
>
> > do you mean changing the used DataSource within
> > a transaction or only how to use multiple databases?
>
> Only how to use with multiple DataSources (each with a different
database
> login and different privelages). i.e. I've defined multiple
DataSources in
> JBoss.
>
Define for each DataSource a jdbc-connection-descriptor.
PB-api:
Use the defined jcdAlias name and PBKey to lookup
the different DataSources
PBKey user_1 = new PBKey(jcdAlias,username, passwd);
PersistenceBroker broker =
PersistenceBrokerFactory.createPersistenceBroker(user_1);
ODMG-api:
Use jcdAlias name to lookup different DataSources
Implementation odmg = OJB.getInstance();
Database db = odmg.newDatabase();
db.open("jcdAlias#username#passwd", Database.OPEN_READ_WRITE);
see http://db.apache.org/ojb/faq.html
(or in shipped docs) sections
'How do I use multiple databases within OJB?'
'Many different database user - How do they login?'
'Needed to put user/password of database connection in repository file?'
HTH
regards,
Armin
> Thanks,
>
> Alex
>
> -----Original Message-----
> From: Armin Waibel [mailto:[EMAIL PROTECTED]
> Sent: Saturday, August 30, 2003 5:01 PM
> To: OJB Users List
> Subject: Re: How to specify non-default DataSource for ODMG/PB api in
> different scenarios?
>
>
> 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]
>
>
> ---------------------------------------------------------------------
> 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]