|
 |
asp_databases thread: How many connection object can be present in a web application
Message #1 by "cindy zhou" <czhou@w...> on Fri, 27 Sep 2002 22:02:05
|
|
I am wondering how many ADO connection object can be present in one web
application. Seems if I open 1st connection, then when I open a 2nd
connection, the 1st one is closed automatically. Is it so that only one
connection can be present?
I am asking this question because I put the ADO connection object in
Application in the file global.asa. And there are two pages in my web
application using DLL to get ADO connection instead of using the
connection object in the Application object. So sometimes when I open the
rest pages, seems the connection object is missing, but sometimes they are
fine. It bothers me very much.
Imar, you still there? Since I have put <%Option Explicit%> on the top of
every page, so give me a hand, please.
Thanks,
Cindy
Message #2 by "Ken Schaefer" <ken@a...> on Mon, 30 Sep 2002 10:36:35 +1000
|
|
You can have as many ADO connections as your database supports.
However, putting an ADO connection object into application scope is usually
a very *bad* idea. Why? Because you serialise all access to your database
through this one single connection.
Better would be to open the connection on each page, and close it again.
Behind the scenes OLEDB takes care of connection management via something
called "resource pooling"
Check this document out:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnmdac/html
/pooling2.asp
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "cindy zhou" <czhou@w...>
Subject: [asp_databases] How many connection object can be present in a web
application
: I am wondering how many ADO connection object can be present in one web
: application. Seems if I open 1st connection, then when I open a 2nd
: connection, the 1st one is closed automatically. Is it so that only one
: connection can be present?
:
: I am asking this question because I put the ADO connection object in
: Application in the file global.asa. And there are two pages in my web
: application using DLL to get ADO connection instead of using the
: connection object in the Application object. So sometimes when I open the
: rest pages, seems the connection object is missing, but sometimes they are
: fine. It bothers me very much.
:
: Imar, you still there? Since I have put <%Option Explicit%> on the top of
: every page, so give me a hand, please.
Message #3 by "cindy zhou" <czhou@w...> on Mon, 30 Sep 2002 16:44:39
|
|
Thanks for the explanation, Ken.
Cindy
|
|
 |