These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: how to connect with multidatabases using hibernate 2.1?
PostPosted: Tue Jul 12, 2005 2:56 pm 
Newbie

Joined: Tue Jul 12, 2005 2:46 pm
Posts: 13
Location: BS2
how to connect with multidatabases using hibernate 2.1?

I can't connect to multiple databases with different hosts

host1 different (!=) host2
password1 different (!=) password2
login1 different (!=) login2

please, one example the hibernate.cfg.xml to connect multdatabase.[/b]


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 12, 2005 4:03 pm 
Regular
Regular

Joined: Wed Nov 17, 2004 11:49 am
Posts: 65
Location: Pittsburgh
I do not know if you can do this with hibernate.cfg.xml. What you need to do is create a sessionFactory for each database to which you wish to connect. You can do this programmatically. In this case, you can use hibernate.cfg.xml to set up the basic (common) configuration of each database and then set the actual connection parameters programmatically. You will probably want to read these from a second (application specific) properties file.


Top
 Profile  
 
 Post subject: Re: how to connect with multidatabases using hibernate 2.1?
PostPosted: Tue Jul 12, 2005 4:04 pm 
Expert
Expert

Joined: Mon Feb 14, 2005 12:32 pm
Posts: 609
Location: Atlanta, GA - USA
netstart wrote:
how to connect with multidatabases using hibernate 2.1?

I can't connect to multiple databases with different hosts

host1 different (!=) host2
password1 different (!=) password2
login1 different (!=) login2

please, one example the hibernate.cfg.xml to connect multdatabase.[/b]


You can't use a single hibernate.cfg.xml to connect to multiple databases.

In order to connect to different databases, you need to configure separate org.hibernate.cfg.Configuration objects, one for each database.

And the hibernate.cfg.xml only allows you to specify a single set of database properties.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.