Using multiple databases from DAAB

Topics: Data Access Application Block
Aug 4, 2009 at 6:42 AM

I have an ecommerce site where I have more than 3 million inventories which is to increase shortly to 8 milion. I'm using currently a single sql server 2005 database. Now what I would like to do is use 2 databases, one for inventory data  and another for the rest such as users, orders, etc.

All the data access is done by a WCF service which is accessed by the website.

What is the right way of getting data from both the databases, merging them before sending them to the web client.

Please let me know if you need any further info.

Thanks and regards

Arnab C

Aug 4, 2009 at 7:26 AM

Hi,

You can define 2 different ConnectionString in your config and just resolve it by passing the name of the connection string. For example, You defined 2 connection strings namely "Inventory" and "Users".

You'll resolve it like this:

//For the Inventory
Database inventoryDatabase = DatabaseFactory.CreateDatabase("Inventory");

//For the Users ... etc...
Database usersDatabase = DatabaseFactory.CreateDatabase("Users");
I'm just not sure what do you mean by "merging". can you explain a bit.
Valiant Dudan
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com
Aug 4, 2009 at 9:53 AM

Thanks for the reply.

Lets say a user has some products from different sellers in his wish list which means wish list shows both the seller name and product name and details.

Now the details of sellers( seller name) is in one database and details of products is in another, and so data from both dbs need to be picked and then merged before sending to the web client.

I would like to know what is the best way of doing this.

Thanks and regards

Arnab C

 

Aug 4, 2009 at 10:59 AM
Edited Aug 4, 2009 at 10:59 AM

Hi,

I cant say that this is the best way, but my idea here is you can query from another database from your stored procedure. Please see this one if this helps : http://bytes.com/groups/ms-sql/81263-how-query-two-ms-sql-dbs-same-server-inside-stored-procedure 

Valiant Dudan
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com