Robin Tucker (idontwanttobespammedanymore (AT) reallyidont (DOT) com) writes:
Quote:
Is it better to maintain a single open connection to the database for the
entire duration of the users session, or to connect, perform an operation
and then disconnect each time the user wants to do some work, within that
session? |
The normal procedure these days is to do both, That is, typically
your code goes:
cnn.Connect;
cmd = cnn.CreateCommand("SELECT ... ")
cmd.Execute
GetData
cmd.close
cnd.Disconnect
But behind the scenes the client library maintains a connection pool,
so when you say disconnect, the library lingers on the connection, so
if you recnnect within some period, the connection is reused. If you
do connect withine some time, typically 60 seconds, the connection is
closed for real.
--
Erland Sommarskog, SQL Server MVP, esquel (AT) sommarskog (DOT) se
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp