Angus Berry wrote:
I'm hoping someone can help me out here. I'm running OJB quite happily, but now I need to add a second Database.
The second database is akin to a data warehouse. It contains a large amount of data that I only want to read from for reference purposes. In the future, other applications may also independently access this database outside of my control, hence I don't want to mingle it's tables with my application specific database.
Can anyone suggest how I should configure this or a strategy to achieve the above
Generally speaking you have two alternatives:
- Setup a separate repository file repositoryWarehouse.xml (with own sub-files for connection repositoryWarehouse_database.xml and object metadata....) and read this new repository at runtime before the first use. Info about how to read and merge metadata can be found here
http://db.apache.org/ojb/api/org/apache/ojb/broker/metadata/MetadataManager.html
- A much simpler soulution will be to extend the existing repository file by using separate sub-files. Create a new repositoryWarehouse_database.xml and define the jdbc-connection-descriptor for the warehouse DB (as you only want to do read-only operations the sequence manager should be never used, but I recommend to set SequenceManagerInMemoryImpl as sequence manager, this implementation doesn't need any external tables).
Create a repositoryWarehouse_user.xml and add all class-descriptor used to access the warehouse tables (be aware of name conflicts with existing class-descriptors).
You can access the warehouse DB (not default connection, attribute 'default-connection' in jdbc-connection-descriptor have to be 'false' in this case) by pass a PBKey to the PBF:
PBKey pbWarehouse = new PBKey(jcdAliasWarehouse,username, passwd);
PersistenceBroker broker = PersistenceBrokerFactory.createPersistenceBroker(pbWarehouse);
regards, Armin
thanks...
--------------------------------------------------------------------- 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]