-->
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.  [ 2 posts ] 
Author Message
 Post subject: Failover using hiberntate
PostPosted: Tue Sep 27, 2011 1:32 am 
Newbie

Joined: Tue Sep 27, 2011 1:23 am
Posts: 2
Hi,

We need to use hibernate to connect to multiple data sources. For e.g. there are 2 Databases A and B. A and B are the mirror images of each other and located on two different machines. Now we want our application to connect to A and if it is unable to connect to A(due to network failure or any other reason) it should automatically detect this and then connect to B.

This is to ensure high availability.

Does hibernate supports this?

Thanks in advance
Shashi


Top
 Profile  
 
 Post subject: Re: Failover using hiberntate
PostPosted: Tue Sep 27, 2011 7:07 am 
Newbie

Joined: Tue Sep 27, 2011 1:23 am
Posts: 2
Can we specify the failover in tnsnames.ora? Is this the correct way to do?

So in our hibernate.properties file we will just specify the url as

Code:
<connection-url>jdbc:oracle:thin:@DBNAME</connection-url>


And in our tnsnames.ora, we will specify the failover as

Code:
DBNAME=
   (DESCRIPTION=
      (ADDRESS_LIST=
         (FAILOVER=on)
         (LOAD_BALANCE=off)
         (ADDRESS=(PROTOCOL=tcp)(HOST=host1)(PORT=1521))
         (ADDRESS=(PROTOCOL=TCP)(HOST=host2)(PORT=1521))
      )
      (CONNECT_DATA=(SERVICE_NAME=DBNAME))
   )


Is this the correct way to do?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.