Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Session variables 1

Status
Not open for further replies.

smash81

Programmer
Mar 12, 2001
88
KE
Hello,
I would like to know if i can have one connection object created for a particular session so that i dont have to keep connecting to the database whenever any data is needed.please tell me how i can do this.
 
Storing a connection object at Session level is a VERY bad idea.

What happens is that you open a connection for each session, and when those sessions timeout you would close the session.

I won't go into the details here,
see

for more information.

Something to keep in mind is that if you are using Access, it will typically fail around 10 concurrent connections, sometimes it will even fail at 3. If you do session level connections, be prepared for your DB to fail on you.

If you are still interested in doing session level connections, just use normal session variable notation.
eg:
set Session("mySessionLevelConnection") = Server.CreateObject(...)

and so on.

hope this helps
leo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top