Print Page | Close Window

Dynamic Connections

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce Classic
Forum Discription: For .NET 2.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=106
Printed Date: 07-Nov-2025 at 1:20pm


Topic: Dynamic Connections
Posted By: rclarke
Subject: Dynamic Connections
Date Posted: 05-Jul-2007 at 6:52am
I want to provide the capability to connect to a different instance of SQL in the event the primary instance is down. This will not be using BOS. In this case there will be a primary server that is normally used. At the end of using the application, a backup (or mirror copy) is made to a backup server or even to the local computer. Upon application start I want to connect first to the primary and if problems exist, prompt the usrer for an alternate SQL Server instance. I know how to get the list of available SQL Server instances but it is not clear to me how to dynamically change the connection string for PM.
 
Thanks in advance,
 
Ron Clarke



Replies:
Posted By: jeffdoolittle
Date Posted: 05-Jul-2007 at 8:06am
I believe what you want is a DataSourceKeyResolver.  You could have two DataSourceKeys in your ibconfig file, called something like "default_primary" and "default_secondary".  In the Resolver code, you could check for availability of the primary server and use the secondary one in case of an outage.  In the event of a disconnect once you've instantiated your PM, you could also switch over to the other DataSourceKey and therefore the other server.
 
Off the top of my head, I'm not sure whether you can change the DataSourceKey of an instantiated PM, or whether you'd have to start a new one and then copy all your existing changes over. 



Print Page | Close Window