wood burning stoves 2.0*
The moose likes JDBC and the fly likes Simulating Database Failover Server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Simulating Database Failover Server" Watch "Simulating Database Failover Server" New topic
Author

Simulating Database Failover Server

Nadeem Awad
Ranch Hand

Joined: Jan 09, 2005
Posts: 74
Hi all,
I'm not sure if this is the right thread to post this topic, so please tell me if it's not.

We are trying to implement a Database failover server (or a Database cluster server) using SQLServer 2000, but without a real clustering from the database server itself, because we have a problem regarding the real Database clustering. So we are looking for a solution, where we assume we have two different databases, one is active and the other are passive, and whenever the active database is down for any reason, the passive database is activated and takes control of other requests. Does anyone have a good solution for this, without having to do it programmatically?

Best regards,


Share Knowledge to gain it.<br /> <br />SCJP 1.2, SCDJWS 1.4, SCWCD 1.4, SCBCD 1.3, ICAD
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3704
    
    5

Originally posted by Nadeem Awad:
Hi all,
We are trying to implement a Database failover server (or a Database cluster server) using SQLServer 2000, but without a real clustering from the database server itself.

Does anyone have a good solution for this, without having to do it programmatically?


What application server are you using? Also, what are you using for your persistence connectivity? There *may* be something in their you can use depending on the webserver and database connection method. Aside from that, I'm not sure what you are looking for. If you are not using real database clustering, then its usually better for a developer to handle it since it can handle more complex logic such as half-completed or nested transactions.

One programmatic solution if this is JDBC is to use a factory method to connect to the database so that a user never calls a specific database directly, and the level of indirection can be leveraged in a database failure.


My Blog: Down Home Country Coding with Scott Selikoff
Nadeem Awad
Ranch Hand

Joined: Jan 09, 2005
Posts: 74
Dear Scott,
I'm using JBoss Application Server, and JDBC for my persistence connectivity. I'm searching to see if there is a well known, tested solution that fulfils my requirement. Of course, implementing this programmatically is valid, but the my management doesn't prefer it because we are somehow approaching a deadline and we haven't developed anything similar to this. So, we might not cover all the aspects or cases for this scenario. Therefore, we are keeping this solution as our last resort.

Best regards,
[ November 30, 2005: Message edited by: Nadeem Awad ]
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3704
    
    5

That sounds ruff. Good recovery systems are something that have to be planned out. The only way to do it last minute I know of is via database recovery solutions from the DBMS.
Nadeem Awad
Ranch Hand

Joined: Jan 09, 2005
Posts: 74
I've found something in JBoss called JBoss JCA Database Failover, where you can give a list of urls when you configure the Datasource, and whenever a connection to a url fails, it moves to the next url, and so on. You can find more information on http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossJCADatabaseFailover

Best regards,
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3704
    
    5

Excellent, I thought there might be something for your specific webserver, although you can never be to sure. Note its listed as experimental, so be a little weary.

Usually, the difficulty in setting something like this is consistency, making sure all databases are consistent so that when one fails the others can pick up quickly. Its often a trade off between speed and safety. For example, initiating a 2PC for all transactions guarentees a certain amount of reliability, but often slows performance to a crawl. Alternatively, asynchronous updates improve performance but reduce reliability since the recovering database may not be fully up-to-date when you want to use it.

In the end, it really matters how your using the data in the database. Good luck though, failover/recovery is not a trivial matter!
 
Consider Paul's rocket mass heater.
 
subject: Simulating Database Failover Server