Connection pooling

  • Thread starter Thread starter Chakra
  • Start date Start date
C

Chakra

This is a newbie question. Why do we typically open a ADO.NET connection,
run a ExecuteNonQuery and close it for every DML statement ? Is it not
possible for an application to open the database connection once at start of
application, use that connection throughout that instance of the
application, and close it at the end of the application ?
 
Hi,

This is what pooling does by default (it keeps open one connection -
normally by default (depends on provider)).
BTW, you are really closing and opening only "logical" connections and not
really closing physicall ones.
The thing is, that if you need more than one connection at the same time
(multithreading or other reason), pooling will help you achieving it without
hassle.
 
Back
Top