Catalog Name Overwrites

Posts   
 
    
NickD
User
Posts: 224
Joined: 31-Jan-2005
# Posted on: 01-Nov-2005 00:29:38   

I know it's my fault, but I can't seem to get the catalog overwrite to work correctly. When I generated the DAL, I used the database name "smartWeekly". Well, that database was offline, so I wanted to use the backup "smartMonthly". I put this in my web.config file:

<configSections>
        <section name="sqlServerCatalogNameOverwrites" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
    </configSections>
    <sqlServerCatalogNameOverwrites>
        <add key="smartWeekly" value="smartMonthly"/>
    </sqlServerCatalogNameOverwrites>

...but still got the "user WebUser does not have access to database smartWEEKLY". I went through and changed the name of all "App.config" files in the DAL root folder spaces to App_OLD.config thinking they might be overridding the web.config, but that didn't help. What am I missing?

Oh, I'm using Adapter and SQL Server 2k.

Paul.Lewis
User
Posts: 147
Joined: 22-Aug-2005
# Posted on: 01-Nov-2005 04:51:43   

Try: type="System.Configuration.NameValueFileSectionHandler

The rest looks good...

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 01-Nov-2005 08:56:04   

Paul.Lewis wrote:

Try: type="System.Configuration.NameValueFileSectionHandler The rest looks good...

No it's NameValueSectionHandler wink . I think the problem is the connection string: it seems the connection string still connects to the old database, which isnt' there.

Frans Bouma | Lead developer LLBLGen Pro
NickD
User
Posts: 224
Joined: 31-Jan-2005
# Posted on: 01-Nov-2005 16:11:07   

My connection string:

<add key="Main.ConnectionString" value="data source=Ganymede.enet.hlpusd.k12.ca.us;initial catalog=SmartMonthly;User ID=SomeUser;Password=SomePassword;persist security info=False;packet size=4096"/>
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 01-Nov-2005 16:53:42   

NickD wrote:

My connection string:

<add key="Main.ConnectionString" value="data source=Ganymede.enet.hlpusd.k12.ca.us;initial catalog=SmartMonthly;User ID=SomeUser;Password=SomePassword;persist security info=False;packet size=4096"/>

Ok, so you can connect, but the queries are wrong, could you enable DQE tracing to see if the queries generated are indeed wrong or at some point wrong? (e.g.: field/table references are ok but in where clauses they're not).

Frans Bouma | Lead developer LLBLGen Pro
NickD
User
Posts: 224
Joined: 31-Jan-2005
# Posted on: 01-Nov-2005 18:13:24   

Otis wrote:

Ok, so you can connect, but the queries are wrong, could you enable DQE tracing to see if the queries generated are indeed wrong or at some point wrong? (e.g.: field/table references are ok but in where clauses they're not).

With the DQE Tracing on, it does indeed use smartWeekly (wrong db). I stepped through some of my code and at the "InitClass" method of the DataAccessAdapter, I noticed that CatalogNameUsage field was "Default". So I followed the yellow brick road some more and when it went into "ReadHandleCatalogNameSettingFromConfig" it threw an exception on

CatalogNameUsage catalogNameUsageSetting = (CatalogNameUsage)(int)configReader.GetValue("CatalogNameUsageSetting", typeof(int));

...what does that mean? Where did I miss the setting? Because then, as you are well aware, it reverts to the default, which in my case is smartWeekly.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 01-Nov-2005 18:37:41   

What's the exception you got in the config read routine? PErhaps that reveals some info simple_smile

Frans Bouma | Lead developer LLBLGen Pro
NickD
User
Posts: 224
Joined: 31-Jan-2005
# Posted on: 01-Nov-2005 19:03:38   

Otis wrote:

What's the exception you got in the config read routine? PErhaps that reveals some info simple_smile

InvalidOperationException

Interestingly enough (at least to me) is that is the only exception you catch, and that is the one that was thrown. So, you apparently only expect to get that error.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 02-Nov-2005 14:50:02   

NickD wrote:

Otis wrote:

What's the exception you got in the config read routine? PErhaps that reveals some info simple_smile

InvalidOperationException

Interestingly enough (at least to me) is that is the only exception you catch, and that is the one that was thrown. So, you apparently only expect to get that error.

I catch only that exception because that exception can be thrown by GetValue() simple_smile , and IF that's thrown, the setting should be ignored. All other errors are propagated upwards, so the user can see errors related to something else.

so this exception is thrown: The value corresponding to the key could not be found in the configuration file. -or-

The specified type does not have a parser.

-or-

The specified type cannot be parsed.

As you stated 1.0.5000 (which is .NET 1.1) as version, it could be this doesnt' work because you're using .NET 2.0 ? (if you're using .NET 1.1, it should work)

Frans Bouma | Lead developer LLBLGen Pro