Catalog name changes between environments

Posts   
 
    
rell
User
Posts: 25
Joined: 15-Apr-2009
# Posted on: 03-Feb-2010 05:20:02   

Hi

The standard for my company is to have different catalog names for the same database in different environments. Eg the database will be F121DEV in development and F121UAT in acceptance.

I have gone through the docco and found the Sql server catalog name overwrites and have set up my config as below.

<configSections> <section name="sqlServerCatalogNameOverwrites" type="System.Configuration.NameValueFileSectionHandler, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> </configSections>

<sqlServerCatalogNameOverwrites> <add key="Catalog" value="Form121Dev" /> </sqlServerCatalogNameOverwrites>

I get the name of the catalog from the config file and assign to a static variable.

I am using the DataAccessAdapter and was trying to use the constructor like below:

        DataAccessAdapter tempfieldstaffadapter = new DataAccessAdapter();
        tempfieldstaffadapter.CatalogNameUsageSetting = CatalogNameUsage.ForceName;
        tempfieldstaffadapter.CatalogNameToUse = strCatalog.ToString().Trim();

This isn't working. Do you have examples of the best way to use the dataaccessadapter contructor to do this.

Or am I doing it completely wrong.

thanks

Rell

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 03-Feb-2010 08:12:53   

If F121DEV was the catalog name used in development and hence the one used to generate the code. And now you want the code to work against F121UAT.

Then all you have to do is:

<sqlServerCatalogNameOverwrites>
    <add key="F121DEV" value="F121UAT" />
</sqlServerCatalogNameOverwrites>

And you don't need to do anything in the code.

Also you may change the catalog name mentionned in the connection string, so that connection succeeds if the original catalog goes offline. So keep this as a habbit to change the connection string too in any case.

rell
User
Posts: 25
Joined: 15-Apr-2009
# Posted on: 03-Feb-2010 23:13:06   

Thanks for this.