Web.Config problem/question

Posts   
 
    
psandler
User
Posts: 540
Joined: 22-Feb-2005
# Posted on: 20-Jul-2006 23:07:34   

We have been using this method of forcing the catalog name in the generated sql (cut and pasted from the docs):


<configuration>
    <appSettings>
        <add key="Main.ConnectionString" value="data source=..."/>
        <add key="CatalogNameUsageSetting" value="1"/>
        <add key="CatalogNameToUse" value="MyProductionCatalog" />
        ...
    </appSettings>
</configuration>

So code similar to what is above is used in the staging/prod environment, and it is commented out in test. The Main.ConnectionString value is the same for all three environments.

The problem is, we have the "initial catalog" setting as part of the Main.Connectionstring. We discovered that when the initial catalogue (which is the test catalog that we generate from) was taken offline, all the sites went down.

Are we doing something wrong? Should we be changing the initial catalog in the web.config as well as adding the override code, or is there a workaround for this? I realize there are newer, better ways to manage this now.

Thanks,

Phil

bclubb
User
Posts: 934
Joined: 12-Feb-2004
# Posted on: 21-Jul-2006 03:26:56   

I believe that you should change the catalog in both areas. If my understanding is correct the CatalogNameToUse is more for when generating the sql, CatalogNameToUse.Table.Field. The connectionstring is used to open the connection to the database.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39927
Joined: 17-Aug-2003
# Posted on: 21-Jul-2006 10:14:59   

To elaborate a bit more: the catalog mentioned in the connection string is the catalog you will connect to after the user/password has been accepted by sqlserver. So if that catalog isn't there, sqlserver can't connect you to a catalog and it fails.

So specify one of the catalogs you will work with for sure in the connection string, or don't take the initial catalog offline.

Frans Bouma | Lead developer LLBLGen Pro
psandler
User
Posts: 540
Joined: 22-Feb-2005
# Posted on: 21-Jul-2006 15:26:48   

Thanks, gents. If no initial catalogue is specified, it goes to the default catalog for the user (assuming SQL Server)?

I'm guessing this has more to do with SQL Server connection strings than LLBL?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39927
Joined: 17-Aug-2003
# Posted on: 22-Jul-2006 12:41:27   

Correct.

Frans Bouma | Lead developer LLBLGen Pro