You should read up on connection pooling. When you open a connection you
aren't physically opening a connection. You get one from the OLEDB/ODBC
pool, and when you close it in your code, it is returned to your pool.
You should *not* use a session object to hold a connection open. You will
kill application scalability (it might work a bit faster, but will support
less users). The session connection will be held open even if it's not being
used by the current user.
You can find information about connection pooling here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnmdac/html/pooling2.asp
There is an explicit warning about using session/application objects to
store connections
The above link doesn't work at the moment, but you can get the article out
of the google.com cache:
http://216.239.57.104/search?q=cache:VhwjVZOsntEJ:msdn.microsoft.com/library/en-us/dnmdac/html/pooling2.asp+site:microsoft.com+Pooling+in+the+Microsoft+Data+Access+Components&hl=en
Cheers
Ken
[quoted text, click to view] "Christian Cooper" <christiancooper77@hotmail.com> wrote in message
news:ac65fea.0404290420.2156b61f@posting.google.com...
: I have a question for you, it involves IIS and database connections.
:
: When I got hired, we were using an asp include file with database
functions
: and would open and close the database connection multiple times in 1
script.
:
: Common sense dictated we should only open the connection once, get all
: necessary information, and close it once per script load. We ran some of
: your stress testing software and obviously saw performance increases.
:
: Then I stumbled upon the ability to open a database connection when the
user
: first creates a session and logs into our authentication, and close it
when
: that session expires or the window is closed. This would mean each user
: using the system would connect once and disconnect when they are done.
: Otherwise, each user using the system would be making let's say 5 database
: connections and disconnections per minute, each time they load an asp
page.
: So if each user uses the system for 1 hour, and there are 500 of them,
there
: are 150 000 open and closes.
:
: My Question:
:
: Wouldn't 500 open and closes be LESS stress on the system, by using a
: persistent connection?
:
: Also, then I can run queries on the system tables and tell how many users
: are logged into the application....
:
: I don't know, the persistent connection seems much better to me, easier to
: use and less network traffic, but I've read the opposite, am I missing
: something?