You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Angus Berry <an...@elken.com> on 2004/08/29 01:19:40 UTC

Re: 2 Databases connected to OJB??

Armin,

The simpler option#2 below, is working for me... thanks.

I wonder if you could describe the syntax to connect to the second DB
using OQL instead of the Native PB.

thanks again...

On Wed, 2004-04-21 at 04:20, Armin Waibel wrote:
> Hi Angus,
> 
> 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: ojb-user-unsubscribe@db.apache.org
> > For additional commands, e-mail: ojb-user-help@db.apache.org
> > 
> > 
> > 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: 2 Databases connected to OJB??

Posted by Armin Waibel <ar...@apache.org>.
Hi Angus,

Angus Berry wrote:
> Armin,
> 
> The simpler option#2 below, is working for me... thanks.
> 
> I wonder if you could describe the syntax to connect to the second DB
> using OQL instead of the Native PB.
> 

Do you mean by the odmg-api? If so try

http://db.apache.org/ojb/docu/faq.html#lookupODMG

But the odmg-api is not designed to use different DB (concurrently) with 
the same thread. In this case you should use two separate 
odmg.Implementation instances and open for each DB a odmg.Database 
instance.

regards,
Armin

> thanks again...
> 
> On Wed, 2004-04-21 at 04:20, Armin Waibel wrote:
> 
>>Hi Angus,
>>
>>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: ojb-user-unsubscribe@db.apache.org
>>>For additional commands, e-mail: ojb-user-help@db.apache.org
>>>
>>>
>>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>>For additional commands, e-mail: ojb-user-help@db.apache.org
>>
>>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
> 
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org