We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now


Datbase connections and ASP

aspdev asked
Medium Priority
Last Modified: 2013-12-25
I am running ASP and an SQL-server. I have set simultanious calls to 15 and the timeout to 30 min. My problem is that since it is a quite big intranet, there is often more than 15 ppl who visits the same page within 30 minutes. In global.asa I have declared:

Set Session("Databas") = Server.CreateObject("ADODB.Connection")
    Session("Databas").Open "DSN=SQL_intranet;UID=xxx;PWD=xxx;APP=MSDS;WSID=AWE1;LANGUAGE=us_english;DATABASE=SQLData_Intranet"

And then, when accessing the database I use:

xxxx = Session("Databas").Execute(string)

and when done I use:
Set xxxx = Nothing

What can I do to end the database call. I tried closing the "databas" session but that only leads to an error message when I go to another ASP page.
Watch Question

Unlock this solution and get a sample of our free trial.
(No credit card required)


The thing is that in the morning, alot of people connect to the intranet at the same time. So lowering the timeout wouldn't be sufficient.
Raising the maximum amount of simultanious connection isn't an good option since that would slow down the intranet.

What I need to happen is that when the data has been exctracted, the connection is dropped but without loosing the value if the Session-variables.

What is the diffrence between global.asa and Connect.inc other than that global.asa doeasn't have to be included in each page?

What happens when the connection is closed due to timeout. Which data is lost (all sesssion variables?) etc.

You can close the connection by:
So you can close the connection object in each page when you don't need it.
SessionVariables are not lost then, with a strange exception in Netscape and Redirecting the user.
For some strange reason I have found several times that Netscape loses the SessionVariables with this code:
But it does not happen consistently.

There's not a real difference between Global.asa and connect.inc, only that I like to know exactly what is going on. Connect.inc is more flexible, 'cause I can give part of the application another connection when I am testing.


I have, on the page in question, added the code you suggested for the Connect.inc file. Then, at the end of the page, I close the connection with Conn.Close

I figured that by opening a "extra" connection for this page and then closing it imediately, I would first of all get rid of the open connection. (unless >15 ppl decide to update the page at once...
Second, I don't affect the other connection from other pages called by the one declared in global.asa.

Does this sound like a good idea or is there something I'm overlooking?


Hmmm... there must be something I'm missing...

It worked fine for a while, and then I got the same error again; To many conections... strange...


What I can come to think of is this:
Whenever someone loads an ASP page. the global.asa opens a connection to the SQL-server. This leads to the fact that no more than 15 persons can access an asp page within 30 minutes.

This would also be true for the "Conn"-connection.
But why does it say that more than 15 is connected if I, at the end of the page, CLOSE the connnection with Conn.close?

I am not sure how Conn.Close and global.asa react. That is why I use connect.inc.
Maybe you should add also
Conn = null
after closing the connection


Ok. Trying that....
Btw, is it possible to have f.i. "0.5" as timeout? and, can it timeout while beeing used, i.o.w. during the time the page is loading?

Hmm, I don't know the answers to your questions. But it worth trying it out.


I tried setting both the timeouts to 1 minute.
and I still close the connection at the end of the page.
All this lead to that the evrything worked fine for more than an hour (doubled the last error time, atleast) but in the end, I got the same "to many conncetions" message again...

Why don't you set the simultanious calls much higher ?


SInce that would slow down the server and also, would mean that I'd have to buy a new license. Though, I'm installing IIS4 nex week with netwok license and on a new mashine so I'll be able to do both after that.

Do you still get comments if I add one later, even if I accept your answer?
I mean, I want to give you the point's, you sure are worth them. But, what if the problem comes up again as soon as I start the new server...

Oh well, just reply to this and I'll give you the points!

Thanx for all your help!



Sybe? You don't want the points?

yes, I want the points, of course :)

And yes, I still get comments, even when the question is PAQ.


Here you go! 100 pts for you, and wow, you don't even have to share ;)

The problem isn't really solved but I'll wait till we have the new server up and running.

Btw, do you know the diffrence between close and abandon? figured abandon could be used with better result maybe?
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.