Switching database at runtime

Posts   
 
    
e106199
User
Posts: 175
Joined: 09-Sep-2006
# Posted on: 08-Feb-2012 23:25:51   

Hi, I have a case where one user needs access several databases of the same structure. Here is an example to make it clear: School A has its own database, School B has its own. I need access to both school databases through a web interface. My account is in School A database so i login through School A web application.

Here i am thinking about having a dropbox with two items: School A and School B. I need the list of items in Table1 in both databases. When School A is selected in dropbox, i want to see the items in Table1 of School A, and when School B is selected i want the Table1 items of School B.

What would be the best way to accomplish this? School A and School B uses replica application with different connection settings in their web config. Both databases have the same structure and are on the same server.

thanks in advance

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 09-Feb-2012 06:16:30   

Hi shane,

Definitively, for this you should use the Adapter Template Set.

When you create the DataAccessAdapter instance, there is a ctor that receive a **CatalogNameOverwriteHashtable **and SchemaNameOverwriteHashtable, you can pass the overwrites with that objects.

Some examples: http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=17302&StartAtMessage=0&#96893 http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=13575&StartAtMessage=0&#75633

David Elizondo | LLBLGen Support Team
e106199
User
Posts: 175
Joined: 09-Sep-2006
# Posted on: 09-Feb-2012 15:38:40   

is it not possible with self servicing template set? this is what i have been using for the rest of the application.

daelmo wrote:

Hi shane,

Definitively, for this you should use the Adapter Template Set.

When you create the DataAccessAdapter instance, there is a ctor that receive a **CatalogNameOverwriteHashtable **and SchemaNameOverwriteHashtable, you can pass the overwrites with that objects.

Some examples: http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=17302&StartAtMessage=0&#96893 http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=13575&StartAtMessage=0&#75633

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 09-Feb-2012 21:56:04   

It's possible modifying the global variable DBUtils.ActualConnectionString. However this has consequences if your application is multi-user. If it is, then Adapter is recommended. See this related thread: http://llblgen.com/tinyforum/Messages.aspx?ThreadID=5288

David Elizondo | LLBLGen Support Team