473,414 Members | 1,764 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

Slow MDB acess in global.asa

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
Jul 19 '05 #1
4 2672
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]
pw******@wandtv.com
WAND-TV (ABC Affiliate)
www.wandtv.com

"Paul Close" <su*****@computerdoctor.com.au> wrote in message
news:eE**************@tk2msftngp13.phx.gbl...
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

Jul 19 '05 #2
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]
pw******@wandtv.com
WAND-TV (ABC Affiliate)
www.wandtv.com

"Paul Close" <su*****@computerdoctor.com.au> wrote in message
news:eE**************@tk2msftngp13.phx.gbl...
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

Jul 19 '05 #3
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

"Phillip Windell" <pwindell{at}wandtv*d0t*com> wrote in message
news:#8**************@TK2MSFTNGP09.phx.gbl...
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]
pw******@wandtv.com
WAND-TV (ABC Affiliate)
www.wandtv.com

"Paul Close" <su*****@computerdoctor.com.au> wrote in message
news:eE**************@tk2msftngp13.phx.gbl...
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


Jul 19 '05 #4
"Arnold Shore" <as****@saefern.org> wrote in message
news:e1**************@TK2MSFTNGP10.phx.gbl...
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]
pw******@wandtv.com
WAND-TV (ABC Affiliate)
www.wandtv.com
Jul 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Freddie | last post by:
Hi, I posted a while ago for some help with my word finder program, which is now quite a lot faster than I could manage. Thanks to all who helped :) This time, I've written a basic batch...
1
by: Lowell Kirsh | last post by:
I created the following class (I know it's a dirty hack) so I could do foo.bar instead of using a dictionary and having to type foo : class DefaultAttr(object): def __getattribute__(self, attr):...
2
by: John Beschler | last post by:
Why are you running this in global.asa anyway? There has to be at least 3 or 4 other BETTER ways to do this. The easiest way would be to create a VB script file that accomplishes the same thing...
2
by: GSpiggle | last post by:
Have recently upgraded to Windows XP and latest Access 2003 from Windows 98 and Access 97. Distribute a lot of front end applications linked to network based data files. During normal working...
7
by: ddsvi78 | last post by:
I am a complete idiot when it comes to access. Now that said, I work for a computer security company and one of our customers came to us with an access problem. They had been running fine for a...
10
by: Jos Vernon | last post by:
I've been trying a mixed mode project but I'm having speed problems. I was using a DLL and linking into it from C#. I thought I'd try and stick the C# functionality and the raw unmanaged code...
8
by: shenanwei | last post by:
I have 2 same windows machine, same instance configure and Database , all run DB2 UDB V8.1.5 Test 1 : create table OUT_1 (LINE VARCHAR(350), LINENUMBER INTEGER NOT NULL GENERATED ALWAYS AS...
6
by: bradb | last post by:
Hello, I have a textbox with an empty span element (place holder) next to it. When the user adds some text to the text box, I create a checkbox in the empty span element. When I create the...
1
by: lokeshreddy16 | last post by:
'this is my code plz guys help how to save data from vb 2005 and other this that i am able to view the data from acess but i am not able save to acess i dont whether my code for save is correct of...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.