connection pooling in asp.net
8 minutes ago|LINK

i searched and read many posts on google about CONNECTION POOLING, it says that it's an temporary memory to keep all then database connections and are used when requests are made to use it but i couldn't figure out its exact meaning like e.g. what in this case when i usually create , open and close my DB connections

e.g.

sqlconnection sqC = new sqlconnection("CONNECTION STRING THAT IS PLACED IN WEB.CONFIG")
.
.
.
.
.

sqc.Open();

//code

sqc.Close();

this i what i usually do and doing since years, so what in this case ? This is connection pooling ? or where it's involved in it ? what when i close my Sqc ? is it by default ?

Connection pooling is a good thing. Before discussing connection pooling, think about what it takes for a web server to make a connection to a database server. If you know a bit about networking, you realize that there is overhead in creating the TCP connection, handshakes, etc.. Rather than opening and closing this connection every time, connection pooling allows asp.net to manage this connection process and make it more efficient.

With connection pooling, it reduces the number of times that these TCP connections must be opened and closed. The asp.net connection pooler will become the "manager" of the actual connection between the web server and DB server. It does this by keeping alive a set of active connections, typically one for each different connection string, as an example...

In your code, when you make an open() call, the pooler will see if there is an available connection in the pool. If there is one available, it will be used instead of opening a new connection to the database. When the code calls a close(), instead of actually closing the connection to the DB, the pooler returns it to the pooled set of active connections. The process continues by "borrowing" the connections in the pool.

This is much more efficient than setting up and destroying actual TCP connections for each event that they are needed.

great ! awesome
just to clear it li'll bit more, i'm asking that when we call .close() on Connection then it actually returns it to pool instead of cutting connection between DB and asp.net ? is it ? and when ever we call it again so it just picks an available connection from pool ? and what about it if connections run out of stock ? not available i mean?

2nd thing, what if i used DATASET ?

we call .close() on Connection then it actually returns it to pool instead of cutting connection between DB and asp.net ?

that is correct..

and when ever we call it again so it just picks an available connection from pool

yes, it will get access to a connection from the pooler.

and when ever we call it again so it just picks an available connection from pool

The pooler will create a new connection to the database. The pooler can manage multiple TCP connections.

2nd thing, what if i used DATASET ?

I dont beleive it matters. The pooler is simply managing the TCP connection, maintaining available connection(s) to the DB. Your code is not aware of what is happening behind the scenes with regard to the connection pooling itself when connections are being established, maintained.

You could disable connection pooling if you really needed to.

thanks awesome jorGem,

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.