LLBLGEN Generate/Refresh USERID Problem

Posts   
 
    
PAZIMLI
User
Posts: 82
Joined: 01-May-2008
# Posted on: 02-May-2008 15:40:11   

Hi,

when we refresh Catalog,a windows appears to get some information from user. These are
OS(Windows) Authentication USERID =CONFIDA40 Passwod=**** We use Oracle. We are lofs of customers, and we want to load customers users as CONFIDA40(enter database OFFICE), CONFIDA40_AK (enter database AKDENIZ), CONFIDA40_CS(enter database CSSS)

We refreh and generate LLBLGEN project and create Dll's like CONFIDADB.dll and CONFIDAdbdbSpesicif.dll,

We use Visual Studio .net,C#,Reference there dlls and App.config file we write connection string as <add key="Main.ConnectionString" value="data source=dbhost;user id=confida40;password=xx;persist security info=false;"/>

If I want to use AKDENIZ database, with user CONFIDA40_AK ,I changed my connection string as <add key="Main.ConnectionString" value="data source=dbhost;user id=confida40_ak;password=xx;persist security info=false;"/>

But After running my program,I saw that my program connect database(HOME) with user CONFIDA40,because LLBLGEN project keep this information in it.And I could not change user information during running of my program.

How can I solve this problem?

thanks. disappointed

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 02-May-2008 15:45:11   

Please use Catalog Name overwriting as specified in the manual's section "Using the Generated code -> Application configuration through .config files"

PAZIMLI
User
Posts: 82
Joined: 01-May-2008
# Posted on: 02-May-2008 15:47:47   

Please explain in detail.

thanks

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 02-May-2008 16:01:20   

The details are in the manual, at the path I specified in the previous message.

Anyway here you are:

manual wrote:

Catalog name overwriting (SqlServer, Sybase ASE) For generated code targeting SqlServer or Sybase ASE, it can sometimes be necessary to use the generated code with a catalog with a different name than the catalog the project was created with. As LLBLGen Pro generates the catalog name into the code, it might be necessary to specify a way to rename the catalog name in the generated code at runtime with a given name. LLBLGen Pro supports multiple catalogs per project, so you can specify more than one rename definition. This feature is similar to the feature discussed in Using the generated code / Adapter / DataAccessAdapter functionality (multi name setting) as it also offers a way to rename multiple catalogs in one go. The renamed data is stored in static hashtables which assure that the Dynamic Query Engines (DQE) for SqlServer and Sybase ASE use the right catalog names without losing any performance.

To setup the renaming of catalogs, follow these steps. The first tag in the configuration tag in the .config file has to be the configSections tag. In there, place a section definition tag as shown in the example below:

<configSections> <section name="sqlServerCatalogNameOverwrites" type="System.Configuration.NameValueSectionHandler" /> </configSections>

Then, the catalog name overwrite definitions have to be placed in key/value pairs inside the sqlServerCatalogNameOverwrites tag, similar as the following examples. The sqlServerCatalogNameOverwrites tag has to be placed inside the configuration tag of the .config file as well.

<sqlServerCatalogNameOverwrites> <add key="OldNameCatalog1" value="NewNameCatalog1" /> <add key="OldNameCatalog2" value="NewNameCatalog2" /> </sqlServerCatalogNameOverwrites>

Note:
For ASP.NET applications, the section declaration has to contain in the type attribute the full type with version and culture, otherwise you'll get an exception at runtime. The specific type declaration is specific for the .NET version you're using and you can find examples how to specify it from the machine.config file in %WINDIR%\Microsoft.NET\Framework\version\CONFIG. For example for .NET 1.1, SqlServer specific:

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

This example makes sure that at runtime any reference in the persistence info of the elements in the generated code to the catalog 'OldCatalogName1' is renamed to 'NewCatalogName1' and any reference to 'OldCatalogName2' is renamed to 'NewCatalogName2'.

You can also specify an empty string as new name. In that case, the DQE will not specify a catalog name in the generated SQL elements, which will make the SQL target the catalog specified in the connection string.

PAZIMLI
User
Posts: 82
Joined: 01-May-2008
# Posted on: 02-May-2008 16:05:57   

I changed my app.config file as

<?xml version="1.0"?> <configuration> <configSections> <section name="oracleSchemaNameOverwrites" type="System.Configuration.NameValueSectionHandler" />

</configSections> <oracleSchemaNameOverwrites> <add key="Confida40" value="Confida40_ak" /> </oracleSchemaNameOverwrites> <appSettings> <add key="Main.ConnectionString" value="data source=dbserver;user id=confida40;password=c;persist security info=false;"/> <add key="buildInValidationBypassMode" value="1"/> <add key="user" value="confida40"/> <add key="password" value="c"/> <add key="source" value="dbserver"/>

<add key="Database" value="Oracle"/>

<add key="MultipleLogin" value="n"/>
<add key="ServerActive" value="n"/>
<add key="PortNum" value="10000"/>

</appSettings> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="EnvDTE" publicKeyToken="B03F5F7F11D50A3A" culture="neutral"/> <bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0"/> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="DevExpress.Utils3" publicKeyToken="79868B8147B5EAE4" culture="neutral"/> <bindingRedirect oldVersion="0.0.0.0-3.2.4.0" newVersion="3.2.4.0"/> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="CoreLab.MySql" publicKeyToken="09AF7300EEC23701" culture="neutral"/> <bindingRedirect oldVersion="0.0.0.0-3.55.21.0" newVersion="3.55.21.0"/> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="SD.LLBLGen.Pro.ORMSupportClasses.NET20" publicKeyToken="CA73B74BA4E3FF27" culture="neutral"/> <bindingRedirect oldVersion="0.0.0.0-2.5.0.0" newVersion="2.5.0.0"/> </dependentAssembly> </assemblyBinding>

</runtime> </configuration>

BUT MY PROBLEM OCCURS. THANKS

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 02-May-2008 16:21:47   

My mistake I'm sorry. The catalog name overwrites are spercific to SQL Server and Sybase. Instead you should be looking at Schema Name overwrites.

Schema name overwriting (SqlServer, Oracle, DB2, PostgreSql, Sybase ASA, Sybase ASE) Besides the ability to rename catalog names, offers LLBLGen Pro also the functionality to rename schema names. This is supported for SqlServer, Oracle PostgreSql, Sybase ASA, Sybase ASE and DB2 databases. These sections work similar to the previously discussed catalog rename feature for SqlServer. Keep in mind that schema renames are global. So you can't rename schema 'dbo' in catalog 'Foo' to 'schema1' and 'dbo' in catalog 'Bar' to 'schema2'.

To setup the renaming of schemas, follow these steps. The first tag in the configuration tag in the .config file has to be the configSections tag. In there, place a section definition tag as shown in the example below. If you also use catalog name renaming, you can place the section definition with the catalog rename section inside the same configSections tag. The following example shows all supported section definitions for schema name overwriting, one for SqlServer, one for DB2, one for Oracle, one for PostgreSql, one for Sybase ASA and one for Sybase ASE. This way, you can define schema overwriting for Oracle, DB2 PostgreSql, Sybase ASA, Sybase ASA and SqlServer in one .config file.

<configSections> <section name="oracleSchemaNameOverwrites" type="System.Configuration.NameValueSectionHandler" /> </configSections>

You then can define the schema name overwrites in their own section:

<oracleSchemaNameOverwrites> <add key="SCOTT" value="HR" /> </oracleSchemaNameOverwrites>

You can rename the same schema for different databases to different names. You can also specify an empty string. In that case, the schema name isn't generated into the SQL. For some situations this can be handy, though keep in mind that if you use empty strings for schemas on SqlServer, you also have to specify an empty string for the catalog name in a catalog name overwrite section.

I hope this works for you.

PAZIMLI
User
Posts: 82
Joined: 01-May-2008
# Posted on: 02-May-2008 16:27:15   

hi, if you look at my above message, you see that I changed my app.config file according to this information you gave me. but I could not find my mistake. Please have a look at my app.config file.

thanks.cry

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 02-May-2008 16:43:46   

dbserver;user id=confida40

Your connection string will attempt to connect to the confid40 user/schema on the dbserver

What happens if you try the folloiwng?

[code]<add key="Main.ConnectionString" value="data source=dbserver;user id=Confida40_ak;password=c;persist security info=false;"/>
PAZIMLI
User
Posts: 82
Joined: 01-May-2008
# Posted on: 02-May-2008 16:48:22   

I run my program.When debug my program

_adapter.ConnectionString= "data source=dbserver;user id=confida40_ak;password=c;persist security info=false;"

I continue to debug, reads 1 table with llblgen(_adapter.fetchtypedlist.....), I saw that table values are Confida40 values.

thanksdisappointed

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 02-May-2008 16:56:49   

Which LLBLGen Pro runtime library version are you using? (details here: http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=7722)

PAZIMLI
User
Posts: 82
Joined: 01-May-2008
# Posted on: 02-May-2008 16:58:17   

LLBLGEN 2.5

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 02-May-2008 17:24:45   

Please check the before mentioned link to know how to get the RTL version number.

PAZIMLI
User
Posts: 82
Joined: 01-May-2008
# Posted on: 02-May-2008 17:36:28   

I solved my problem.

My mistake is uppercase,lowercase problem.

I write Confida40 as CONFIDA40 (UPPERCASE).

thanks for your reply.