Thursday, March 22, 2012

Connection Pooling

Is there some way to use only a single connection pool for more than 10 diferent databases?No, you get a connection pool per unique connection string. (Any changes to the connection string, including parameter ordering, extra spaces, etc. will create a new connection pool. The connection pooling layer doesn't try to do any parsing to determine equivalent connection strings.)

Connections to databases are expensive to establish. Connection pooling keeps a connection open for a certain amount of time after you issue a conn.Close() assuming that you might want to use it again. You have a physical connection between your client and a specific database over some protocol, such as TCP/IP, named pipes, or other. So using the same connection pool across multiple databases doesn't make logical sense to me.

Could you explain in more detail what you're trying to accomplish? Maybe you are using the wrong terminology.|||First, thanx for your post James!

I do already know about a connection pool per connection string. I'm trying to figure out some way to eliminate this. Can be anything at low level. I'm studying the OLEDB technology to discover if it is possible and is plausible. I agree with you about "doesn't make logical sense". I'm playing with this :).

Thanx, once again... If you know anything else let me know.|||You can always turn off OLE DB connection pooling and then roll your own. Add the following to the connection string: "OLE DB Services=-4". (This also turns off automatic transaction enlistment.) More details can be found here:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconconnectionpoolingforoledbnetdataprovider.asp

and here:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/oledb/htm/oledbabout_the_ole_db_documentation.asp

Other providers use their own syntax for disabling connection pooling. For instance, the SQL Server Client Provider uses the syntax "Pooling=false".sqlsql

No comments:

Post a Comment