Ask a Question related to ASP Database, Design and Development.
-
Dale Mumper #1
IIS leaving too many SQL db connections
Greetings.
I have a site with several pages that connect to a SQL
2000 database with a connection string stored in a session
variable. After navigating through a number of pages with
database access, there are a plethora of database
connections left open on the server. This is an IIS 5
site on a W2K going against a SQL 2K database on the same
server. I do all of the proper things, such as:
Dim cn
Set cn = Server.CreateObject("ADODB.Connection")
cn.ConnectionString = Session("CString")
cn.Open
' do stuff with recordset or whatever
cn.Close
Set cn = Nothing
What can I do to avoid all of these connections? In my
testing, I can get it up to 9 just as a single user in a
test environment. But I have another install where they
proclaim 26 connections.
Is this the OLE DB connection pooling figuring that I need
that many connections? It seems a wee bit excessive.
Thanks.
Dale Mumper Guest
-
Delete record without leaving orphans
I have 2 MS access tables "links" and "linkCategory" where links get assigned to a category for display. I want to be able to delete a... -
Detect leaving page
Looking for a method to detect when the user presses the "Back" button and also Alt+> Thanks for any insight! Kevin -
Leaving bookmarks open when going to a new page
My bookmarks are visible when I OPEN the document, but when I click on a bookmark to go to a different page, they close. I have to click the... -
Detect for cursor leaving stage
Hey all - I have a menusystem that needs to know if the cursor has left the stage. Is there any code that will do the trick? Right now I have... -
What are the dangers of leaving a cgi-bin directory CHMOD 777
I have a perl script that writes to its directory, and as such the directory is CHMOD 777 in my cgi-bin. (Linux box) I figured this might be... -
Aaron Bertrand - MVP #2
Re: IIS leaving too many SQL db connections
> Set cn = Server.CreateObject("ADODB.Connection")
Does this connection string change per user? If not, use a single> cn.ConnectionString = Session("CString")
connection string in an application variable. If you use session level,
then if you have a user with cookies disabled, they will start a new session
on each page...
Is this causing a problem, or is the app behaving fine and you are just> Is this the OLE DB connection pooling figuring that I need
> that many connections? It seems a wee bit excessive.
being highly analytical?
Aaron Bertrand - MVP Guest
-
Aaron Bertrand - MVP #3
Re: IIS leaving too many SQL db connections
> It's not causing a performance issue at this point, so it
Idle connections are not exactly "trash"... a new user picking up an idle> is being somewhat analytical. I was just amazed that what
> I thought was sound code was leaving so much trash around.
connection is much more efficient than the overhead of initiating a brand
new connection from the database.
Let connection pooling do its work. Worry about it when it becomes an
issue.
Okay, then see some shorter versions of connection strings. :-)> And as far as setting cn.ConnectionString, I guess that
> old habits die hard. I probably will start doing it your
> way, though. Less typing makes me happy.
[url]http://www.aspfaq.com/2126[/url]
Aaron Bertrand - MVP Guest



Reply With Quote

