Hi,

I need to switch between at least two database sources in my application. As far as I can see, there is no way to switch between database connection with the JDO-API and the methods setConnectionURL() etc. of the PersistenceManagerFactory.
So I configured a second database-connection in my repository_database.xml and made it default in my application via the following code:


ConnectionRepository cp = MetadataManager.getInstance().connectionRepository();

PBKey pbk = cp.getStandardPBKeyForJcdAlias("secondDB");

JdbcConnectionDescriptor cd = cp.getDescriptor(pbk);

cd.setDefaultConnection(true);

The good news: it works.

But as it seems not very elegant it leaves the question: is this today the only way to switch between databases with the JDO-implementaion of OJB or am I missing something?

Thanks in advance for any hints.

Regards
Franz


-- Franz-Josef Herpers Puschkinallee 9A 12435 Berlin 030/53 21 33 02 0173/54 23 666 [EMAIL PROTECTED]


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



Reply via email to