switching between the database

Posts   
 
    
bikswan
User
Posts: 14
Joined: 20-May-2009
# Posted on: 28-May-2009 18:20:56   

Hi,

I am developing an application which have to deal with multiple databases at the same time.

For example:

I have one database called 'MasterDB' which consists of all the entities global to all the cases.

And I will have many databases like 'Case1DB', 'Case2DB' etc which are for now in the same server, if possible I would like to move some cases to different servers later. Remember Case1DB & Case2DB will be exactly with same schema.

I generated the llblgen code adding MasterDB and one of the CaseDB which are in the the same server. I used self servicing and able to get the DAL I was looking for.

Now, my problem is that, Most often I will user MasterDB but when the user wants I have to switch between the cases in run time. I cannot put all these things in app.config because I will not know when new case will come. Actually MasterDB keeps the record of every cases and connection strings and I have to use that connection string during run time.

I hope you understand my problem.

I tried overriding the catalogs but its not working.

Thanks in Advance.

regards,

Bibek Dawadi

MTrinder
User
Posts: 1461
Joined: 08-Oct-2008
# Posted on: 28-May-2009 19:46:03   

Hi

For multiple database, Adapter is a much better choice that SelfServicing. It means you can have DataAccessAdapter per database, and supply the connection string to it at runtime.

Take a look at this thread which addresses the same question.

Also do a search of the forums for "Multiple Database" as this questions is asked and answered fairly frequently.

If you are still having issues, try to come back to us with some specific information "it isn't working" doesn't give us a lot to go on simple_smile

Matt

bikswan
User
Posts: 14
Joined: 20-May-2009
# Posted on: 06-Jul-2009 19:14:56   

hi,

Now I am switching to Adapter.

I have to now insert / update / delete multiple rows from two tables A and B. Table A and B are from two different databases.

How can I do this in same transaction?

regards,

Bibek Dawadi

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 07-Jul-2009 05:28:53   

On sqlserver, you have a couple of options: on sqlserver 2000, you need COM+ transactions (enterprise services) on sqlserver 2005, you can use System.Transactions transactions which are more lightweight and will automatically promote to COM+ transactions if you use multiple sources (2 or more databases/connections)

Oracle has an MTS service, which basicly plugs into MS DTC for distributed transactions so you could commit a transaction over COM+ into oracle and sqlserver at the same time. However I'm not sure what the current state is of Oracle's MTS service: if it can handle all possible COM+ transactions or that it still operates on the level of MTS (the predecessor of COM+)

David Elizondo | LLBLGen Support Team