Connection Pooling

  • Thread starter Thread starter Miss
  • Start date Start date
M

Miss

Hi,
I have a very basic question regarding the connection pooling.

To use the built in connection pooling, do I have to have a connection
object created in some shared class?
Right now, I have a data access class created and disposed each time
database query is made(connection is created and closed in this class)

Any suggestions appreciated

John
 
Thanks Wayne for the info,

But my question remains the same

I have a remoted object in the middle tier and they access the database thru
the data access class. This class constructed and destroyed for each call.
To use the connection pool does this connection object has to be a shared
object?

Thanks
 
I believe you are ok as long as you follow the rules in tip 3. However, if
the middle tier is unloaded I think you lose the connection pooling.
Hopefully someone else will have a more certain answer for you.

Wayne
 
You class does not need to be shared (im assuming you are using
VB.Net). The connection pooling behavior depends on the provider you
are using. For example, if you are using SqlConnection to connect to
the database, the SqlConnection automatically manages pooling.

The first time you open a connection it will create a pool with the
connection string you passed. Then subsequent call will first check to
see if a connection already exists an is available in the pool. If yes
it will use that connection, otherwise it will create a completely new
connection and add that to the pool. This way even if your class is
destroyed your connection pool doesnt untill the process exits.

To take advantage of this though, be sure to use the same connection
string. The slightest variation in the string (even casing) can cause
the connection to create a completely different connection pool.

NuTcAsE
 
Thank you very much.

I just confirmed what you wrote(from the sql server current processes).

I was worried that since I am destroying my class the connecting might get
lost.

But its working as both of you suggested.

Thanks again!



But the connection pooling works outside the d
 
Back
Top