Simultaneous Database Connections

Posts   
 
    
Posts: 112
Joined: 09-Aug-2004
# Posted on: 23-May-2005 16:29:29   

I am looking for some guidance on this one. Here is our scenario;

We have a Master Database. This Database will store connection information to a series of other databases. All of these databases have the exact same schema (And all will be SQL 2000). There is one, and only one master database. Its schema is different from the series of databases schemas. Its connection information will never change.

The trickest part is this, a user may select which databases they would like to fetch data from. They can choose to select any combination of databases. When the data is fetched, it is fetched from all databases and all the results are all displayed at the same time.

What do you think is the best way to accomplish this? I was thinking of a self servicing solution, but passing connection information through the constructor in Adapter seems like it would make things easier.

I am currently trying to decide if I should but something on top of LLBLGen's Generated code, or if I should modify the code. But I am not limited to these solutions, these are the only ones I have thought of.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39750
Joined: 17-Aug-2003
# Posted on: 23-May-2005 20:56:19   

You definitely should use adapter, not selfservicing. Use a different project for the master database. Use that project (and its adapter) to fetch the connection information, then use that connection information to connect to the db at hand, for example by setting the catalog name in the DataAccessAdapter object you're using on the databases. You have to query per database.

Frans Bouma | Lead developer LLBLGen Pro
Posts: 112
Joined: 09-Aug-2004
# Posted on: 23-May-2005 22:28:30   

Otis wrote:

You have to query per database.

We would definatly need a layer to combine the results of each specific query.

I imagine a collection.add would suffice. Do you have any better ideas?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39750
Joined: 17-Aug-2003
# Posted on: 24-May-2005 16:08:57   

lethologica wrote:

Otis wrote:

You have to query per database.

We would definatly need a layer to combine the results of each specific query. I imagine a collection.add would suffice. Do you have any better ideas?

You can pass the same EntityCollection object to the FetchEntityCollection method for every database of course, so the fetches are added to the same entitycollection. If you don't mind duplicates, set EntityCollection.DoNotPerformAddIfPresent to false, otherwise entities with the same PK as an entity already in the collection are ignored.

Frans Bouma | Lead developer LLBLGen Pro