Visual Basic .NET » Database Programming
Connection pooling -- Parasyke --


Could someone explain a detail in connection pooling? Say I have 10 Methods that I call at the same time within one Sub: Connect Database A, Connect Database B, Connect Database B, Connect Database B, Connect Database C, Connect Database D, Connect Database E, Connect Database F,
Connect Database F, Connect Database G. Am I creating a pool of 7 since some of the methods connect to the same database?

Thanks! James

-- Tito --


For each new instance of an object that is making the connection, you will have a open connection. It does not matter what database the connections go to. So for an example, if you have a multi-threading application that run 5 threads and if each one of those threads opens a connection to the same database, you will notice that you have 5 open sessions to that database.

-- Cerebrus --


Connection pooling can differ depending on whether you're using the OleDbConnection or the SqlConnection.

Pooling will *only* occur if you use the same connection string for opening a new connection, as that for a connection that is already open.

Add the Pooling = 'true' attribute to your connection string to enable it.

-- Parasyke --


So if I am using sqlConnection with Pooling enabled then in my original example I will have 10 connections (?)
Thanks to all!

[Submit Comment]Home