Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ASP / Database Access / September 2003



Tip: Looking for answers? Try searching our database.

Slow MDB acess in global.asa

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Paul Close - 28 Sep 2003 23:54 GMT
Hi Everyone,

The following code runs in less than one second when used in an ASP page but
when used in Session_onStart() in global.asa, the first page in a new
session is delayed by more than thirty seconds. The code seems to work - its
just slooow. Why is this so and how do I fix it?

 Dim cnComDoc
 Set cnComDoc = Server.CreateObject("ADODB.Connection")
 cnComDoc.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=c:\comdoc.mdb;Persist Security Info=False"
 cnComDoc.execute "Insert into SessionInfo
(SessionID,BeginDateTime,IPAddress) values ('" & Session.SessionID & "','" &
FormatDateTime(now(), vbGeneralDate) & "','" &
Request.ServerVariables("REMOTE_ADDR") & "')",,adCmdText +
adExecuteNoRecords
 Set cnComDoc = Nothing
Phillip Windell - 29 Sep 2003 14:42 GMT
You fix it by not doing it in the Global.asa file.  You're supposed to
do it in the ASP file that needs it (use an Include file).

--

Phillip Windell [CCNA, MVP, MCP]
pwindell@wandtv.com
WAND-TV (ABC Affiliate)
www.wandtv.com

> Hi Everyone,
>
[quoted text clipped - 13 lines]
> adExecuteNoRecords
>   Set cnComDoc = Nothing
Arnold Shore - 29 Sep 2003 22:22 GMT
Good advice, I guess; I've been fighting that symptom.  But where does it
say that "You're supposed to do it in the ASP file that needs it"

AS

> You fix it by not doing it in the Global.asa file.  You're supposed to
> do it in the ASP file that needs it (use an Include file).
[quoted text clipped - 27 lines]
> > adExecuteNoRecords
> >   Set cnComDoc = Nothing
Phillip Windell - 30 Sep 2003 17:32 GMT
> Good advice, I guess; I've been fighting that symptom.  But where does it
> say that "You're supposed to do it in the ASP file that needs it"

It's the "proverbial it", kinda like the "proverbial they".

It is just the normal principle of only creating what you need when
you need it, then use it, then close or eliminate it as soon as your
finished, rather than do it in the global.asa where it continues to
exist throught the life of the Application.

Plus using it in Include files means if a page doesn't require any
database activity, then the particular Include file isn't used,
therefore no resources are used for a database connection that you
don't need. In other words,...treat each page as its own individual
stand-alone program except for specific situations that require
otherwise. That is the concept that HTTP is built on anyway.

--

Phillip Windell [CCNA, MVP, MCP]
pwindell@wandtv.com
WAND-TV (ABC Affiliate)
www.wandtv.com
Phillip Windell - 29 Sep 2003 14:58 GMT
Sorry, I should have added more. Yes the Global.asa would seem to be
the logical place to do this, but from what I've seen it doesn't
always work that well. I assume you are wanting to track a user to see
how long they were there or estimate when they left the site.
If you're wanting to store the Session ID, then you'd want to make
sure that the Session ID doesn't already exist before adding the
record so it doesn't add a duplicate record each time they move to
another page.  You probably would want some kind of timestamp that is
updated with each page they go to and then if the timestamp becomes
older than the site's Session Timeout then either delete the record or
do some other action based on that.

--

Phillip Windell [CCNA, MVP, MCP]
pwindell@wandtv.com
WAND-TV (ABC Affiliate)
www.wandtv.com

> Hi Everyone,
>
[quoted text clipped - 13 lines]
> adExecuteNoRecords
>   Set cnComDoc = Nothing
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.