ChangeDatabase and connection pooling

G

Guest

Hello All,

I have a web application that uses multiple databases all residing on the
same SQL Server with similar info, thus 1 aspx page will reference one of 10
possible databases depending on what the user is doing. Now, I want all my
connections to the database server to reside in the same connection pool.

So, I was thinking about using a single connection string to connect to
'master' for every page, then invoke
SqlConnection.ChangeDatabase("other_database"). The question then is... by
calling ChangeDatabase to point to a different database, will that remove
that connection from the connection pool? If so, can I return it to the pool
by calling ChangeDatabase() again before disconnecting to point back to
'master'?

Thanks in advance for your help,
 
W

William \(Bill\) Vaughn

The connection pooling mechanism can be monitored to see what it does.
Generally, it inspects the ConnectionString. If it's the same, the mechanism
assumes you're working with the same
server/database/user/transaction/process context.


--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
G

Guest

Bill,

What technique can I use, either in code or in some separate application, to
monitor the pooling mechanism?

Thanks,
Nate
 
W

William \(Bill\) Vaughn

The Framework exposes performance counters that can monitor the pool, but
only the 2.0 version counters are particularly reliable.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top