Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access_asp thread: Access DB locking up/Connection problem


Message #1 by "Omar Higgs" <ohiggs@n...> on Mon, 11 Nov 2002 21:44:03
I am writing to an Access database that site on a web server from ASP.  
I'm using a DSN-less connection for this.  Once I write to the database I 
cannot establish ANY subsequent connections to it without hogging the 
server CPU.  I actually have to get the techs to kill the process and I 
have to overwrite the DB with a backup before I can proceed.

Using a DSN-less connection did not help at all. Could IIS or COM+ be the 
issue here?
Message #2 by "Ken Schaefer" <ken@a...> on Tue, 12 Nov 2002 11:54:56 +1100
Sounds like you have an infinite loop in your code (or something similar).

Cheers
Ken

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Omar Higgs" <ohiggs@n...>
Subject: [access_asp] Access DB locking up/Connection problem


: I am writing to an Access database that site on a web server from ASP.
: I'm using a DSN-less connection for this.  Once I write to the database I
: cannot establish ANY subsequent connections to it without hogging the
: server CPU.  I actually have to get the techs to kill the process and I
: have to overwrite the DB with a backup before I can proceed.
:
: Using a DSN-less connection did not help at all. Could IIS or COM+ be the
: issue here?

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Message #3 by "Omar Higgs" <ohiggs@n...> on Tue, 12 Nov 2002 02:06:24
No looping.  Just an update statement.

At this point, I'm completely lost abou this problem.

----------------------
> Sounds like you have an infinite loop in your code (or something 
similar).

Cheers
Ken

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Omar Higgs" <ohiggs@n...>
Subject: [access_asp] Access DB locking up/Connection problem


: I am writing to an Access database that site on a web server from ASP.
: I'm using a DSN-less connection for this.  Once I write to the database I
: cannot establish ANY subsequent connections to it without hogging the
: server CPU.  I actually have to get the techs to kill the process and I
: have to overwrite the DB with a backup before I can proceed.
:
: Using a DSN-less connection did not help at all. Could IIS or COM+ be the
: issue here?

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Message #4 by "Ken Schaefer" <ken@a...> on Tue, 12 Nov 2002 15:02:22 +1100
Please post the code you are using.

Cheers
Ken

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Omar Higgs" <ohiggs@n...>
Subject: [access_asp] Re: Access DB locking up/Connection problem


: No looping.  Just an update statement.
:
: At this point, I'm completely lost abou this problem.
:
: ----------------------
: > Sounds like you have an infinite loop in your code (or something
: similar).
:
: Cheers
: Ken
:
: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: From: "Omar Higgs" <ohiggs@n...>
: Subject: [access_asp] Access DB locking up/Connection problem
:
:
: : I am writing to an Access database that site on a web server from ASP.
: : I'm using a DSN-less connection for this.  Once I write to the database
I
: : cannot establish ANY subsequent connections to it without hogging the
: : server CPU.  I actually have to get the techs to kill the process and I
: : have to overwrite the DB with a backup before I can proceed.
: :
: : Using a DSN-less connection did not help at all. Could IIS or COM+ be
the
: : issue here?
:
: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Message #5 by "Omar Higgs" <ohiggs@n...> on Tue, 12 Nov 2002 04:28:23
HERE'S THE CODE THAT DOES THE UPDATE:

<!--#include file="../shared/connection.asp" -->
<%
banneradID = request("banneradID")
divisionID = request("divisionID")
action = request("action")
deaID = request("deaID")
	if deaID = "" then deaID = 0
bactive = request("bactive")
	if bactive = "Yes" then
		bactive = 1 
	else
		bactive = 0
	end if 
 	
link = request("link")

if link = "" then link = " "

description = replace(request("description"),"'","''")
		if description = "" then description = " "

bannertype = request("bannertype")

if action = "update" then
	
	sql = "update bannerads set 
bannertype='"&bannertype&"',bactive="&bactive&",link='"&link&"',description
='"&description&"',deaID="&deaID&",divisionID="&divisionID&" where 
banneradID=" & banneradID 
	set rs = conn.execute(sql)
	conn.close
	set conn = nothing
end if


%>




> Please post the code you are using.

Cheers
Ken

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Omar Higgs" <ohiggs@n...>
Subject: [access_asp] Re: Access DB locking up/Connection problem


: No looping.  Just an update statement.
:
: At this point, I'm completely lost abou this problem.
:
: ----------------------
: > Sounds like you have an infinite loop in your code (or something
: similar).
:
: Cheers
: Ken
:
: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: From: "Omar Higgs" <ohiggs@n...>
: Subject: [access_asp] Access DB locking up/Connection problem
:
:
: : I am writing to an Access database that site on a web server from ASP.
: : I'm using a DSN-less connection for this.  Once I write to the database
I
: : cannot establish ANY subsequent connections to it without hogging the
: : server CPU.  I actually have to get the techs to kill the process and I
: : have to overwrite the DB with a backup before I can proceed.
: :
: : Using a DSN-less connection did not help at all. Could IIS or COM+ be
the
: : issue here?
:
: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Message #6 by "Ken Schaefer" <ken@a...> on Tue, 12 Nov 2002 15:48:56 +1100
So, after you run this page below, you can't run any other .asp page? Or you
can't connect to the database anymore? Can you show me the code of the 2nd
page that doesn't run anymore?

Also, what is in the page:
<!--#include file="../shared/connection.asp" -->

Secondly, you are closing your connection inside your If...End If
conditional, but you appear to be opening the connection outside the
conditional. You shoudl change your code so that it *always* closes the
connection (ie, move the code to close the connection to ourside the
conditional).

Cheers
Ken

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Omar Higgs" <ohiggs@n...>
Subject: [access_asp] Re: Access DB locking up/Connection problem


: HERE'S THE CODE THAT DOES THE UPDATE:
:
: <!--#include file="../shared/connection.asp" -->
: <%
: banneradID = request("banneradID")
: divisionID = request("divisionID")
: action = request("action")
: deaID = request("deaID")
: if deaID = "" then deaID = 0
: bactive = request("bactive")
: if bactive = "Yes" then
: bactive = 1
: else
: bactive = 0
: end if
:
: link = request("link")
:
: if link = "" then link = " "
:
: description = replace(request("description"),"'","''")
: if description = "" then description = " "
:
: bannertype = request("bannertype")
:
: if action = "update" then
:
: sql = "update bannerads set
:
bannertype='"&bannertype&"',bactive="&bactive&",link='"&link&"',description
: ='"&description&"',deaID="&deaID&",divisionID="&divisionID&" where
: banneradID=" & banneradID
: set rs = conn.execute(sql)
: conn.close
: set conn = nothing
: end if
:
:
: %>
:
:
:
:
: > Please post the code you are using.
:
: Cheers
: Ken
:
: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: From: "Omar Higgs" <ohiggs@n...>
: Subject: [access_asp] Re: Access DB locking up/Connection problem
:
:
: : No looping.  Just an update statement.
: :
: : At this point, I'm completely lost abou this problem.
: :
: : ----------------------
: : > Sounds like you have an infinite loop in your code (or something
: : similar).
: :
: : Cheers
: : Ken
: :
: : ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: : From: "Omar Higgs" <ohiggs@n...>
: : Subject: [access_asp] Access DB locking up/Connection problem
: :
: :
: : : I am writing to an Access database that site on a web server from ASP.
: : : I'm using a DSN-less connection for this.  Once I write to the
database
: I
: : : cannot establish ANY subsequent connections to it without hogging the
: : : server CPU.  I actually have to get the techs to kill the process and
I
: : : have to overwrite the DB with a backup before I can proceed.
: : :
: : : Using a DSN-less connection did not help at all. Could IIS or COM+ be
: the
: : : issue here?
: :
: : ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:

Message #7 by "Omar Higgs" <ohiggs@n...> on Tue, 12 Nov 2002 05:10:12
Yes, this is correct.  I cannot run any subsequent pages without the 
server CPU spiking severely.  I have to get the techs to kill the process 
and restart the site.

The page I normall go to afterwards is a page of frames.  The frame HTML 
page uses the following code:

=======================================================
<!--#include virtual="../shared/connection.asp" -->
<!--#include virtual="../shared/bannersql.asp" -->
<html>
	<head>
		<title>Autobysite.com</title>
		<meta http-equiv="Content-Type" content="text/html; 
charset=iso-8859-1">
	</head>
	<frameset rows="150,*" frameborder="NO" border="0" 
framespacing="0">
		<frameset frameborder="NO" border="0" framespacing="0" 
cols="300">
		<frame name="topFrame" scrolling="NO" 
src="/main/f_top.asp" marginwidth="0" marginheight="0" frameborder="NO">
		</frameset>
	    <frameset frameborder="NO" border="0" framespacing="0" 
cols="300">
		<frameset frameborder="NO" border="0" framespacing="0" 
rows="*,*">
			<frameset cols="155,460,*" frameborder="NO" 
border="0" framespacing="0">
			<frame name="left nav" scrolling="YES" noresize 
src="/main/f_leftnavbanners.asp" marginwidth="0" marginheight="0" 
frameborder="NO">
			<frame name="mainFrame" 
src="http://www.chromecarbook.com/start.asp?
ID=101392&cpntext=continue&r2=2000000" scrolling="AUTO" marginwidth="0" 
marginheight="0" frameborder="NO" noresize>
			<frame name="rightFrame" scrolling="AUTO" 
src="f_right.asp" marginwidth="0" marginheight="0" frameborder="NO" 
noresize>
			</frameset>
			<frame src="/main/UntitledFrame-3">
		</frameset>
	    </frameset>
	</frameset>
	<noframes>
		<body bgcolor="#FFFFFF" text="#000000">
		</body>
	</noframes>
</html>

=========================
Each frame in the page uses a set of include files. I'll send those in the 
following reply.


---------------------------------------------------------------
> So, after you run this page below, you can't run any other .asp page? Or 
you
can't connect to the database anymore? Can you show me the code of the 2nd
page that doesn't run anymore?

Also, what is in the page:
<!--#include file="../shared/connection.asp" -->

Secondly, you are closing your connection inside your If...End If
conditional, but you appear to be opening the connection outside the
conditional. You shoudl change your code so that it *always* closes the
connection (ie, move the code to close the connection to ourside the
conditional).

Cheers
Ken

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Omar Higgs" <ohiggs@n...>
Subject: [access_asp] Re: Access DB locking up/Connection problem


: HERE'S THE CODE THAT DOES THE UPDATE:
:
: <!--#include file="../shared/connection.asp" -->
: <%
: banneradID = request("banneradID")
: divisionID = request("divisionID")
: action = request("action")
: deaID = request("deaID")
: if deaID = "" then deaID = 0
: bactive = request("bactive")
: if bactive = "Yes" then
: bactive = 1
: else
: bactive = 0
: end if
:
: link = request("link")
:
: if link = "" then link = " "
:
: description = replace(request("description"),"'","''")
: if description = "" then description = " "
:
: bannertype = request("bannertype")
:
: if action = "update" then
:
: sql = "update bannerads set
:
bannertype='"&bannertype&"',bactive="&bactive&",link='"&link&"',description
: ='"&description&"',deaID="&deaID&",divisionID="&divisionID&" where
: banneradID=" & banneradID
: set rs = conn.execute(sql)
: conn.close
: set conn = nothing
: end if
:
:
: %>
:
:
:
:
: > Please post the code you are using.
:
: Cheers
: Ken
:
: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: From: "Omar Higgs" <ohiggs@n...>
: Subject: [access_asp] Re: Access DB locking up/Connection problem
:
:
: : No looping.  Just an update statement.
: :
: : At this point, I'm completely lost abou this problem.
: :
: : ----------------------
: : > Sounds like you have an infinite loop in your code (or something
: : similar).
: :
: : Cheers
: : Ken
: :
: : ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: : From: "Omar Higgs" <ohiggs@n...>
: : Subject: [access_asp] Access DB locking up/Connection problem
: :
: :
: : : I am writing to an Access database that site on a web server from 
ASP.
: : : I'm using a DSN-less connection for this.  Once I write to the
database
: I
: : : cannot establish ANY subsequent connections to it without hogging the
: : : server CPU.  I actually have to get the techs to kill the process and
I
: : : have to overwrite the DB with a backup before I can proceed.
: : :
: : : Using a DSN-less connection did not help at all. Could IIS or COM+ be
: the
: : : issue here?
: :
: : ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:

Message #8 by "Omar Higgs" <ohiggs@n...> on Tue, 12 Nov 2002 05:20:55
1) The connection.asp page is:
<% 		 
	connectionstring="dsn=abs"
	set conn = server.createobject("ADODB.Connection")
	conn.open connectionstring

%>
=========================================================================
2) The other include files are:

<% 
ccc = request.cookies("cuID")
if ccc = "" then ccc = 0 

if ccc > 0 then
	sql2 = "select divisionID from creditunions where cuID=" & ccc
	set cc = conn.execute(sql2)
	 
	sql = "select * from bannerads where (bactive=1 and divisionID="&cc
("divisionID")&" and bannertype='New')"
else 
	sql = "select * from bannerads where bactive=1"
end if 

set rs = Server.CreateObject("ADODB.Recordset")
rs.cursorlocation = aduseclient
rs.open sql,connectionstring 
'response.write sql 
listcount = rs.recordcount 
listcount1 = cint(listcount)
	
	dim num()
	dim banneradID()
	dim link()
	dim bannerad()
	redim num(listcount1)
	redim banneradID(listcount1)
	redim link(listcount1)
	redim bannerad(listcount1)

	i = 0 
	while not rs.eof
		i = i + 1 
		banneradID(i) = rs("banneradID")
		link(i) = rs("link") 
		bannerad(i) = rs("bannerad")
		
	rs.movenext
	wend 
	
	for x = 1 to 5 
		
		if x = 1 then 
			randomize
			numm = cint(int((rnd * i) + 1))
		end if 

		if x = 2 then 
			Do Until (numm <> num(1))
				randomize
				numm = cint(int((rnd * i) + 1))
			Loop
		end if   
		
		if x = 3 then 
			Do Until (numm <> num(1) and numm <> num(2))
				randomize
				numm = cint(int((rnd * i) + 1))
			Loop
		end if   

		if x = 4 then 
			Do Until (numm <> num(1) and numm <> num(2) and 
numm <> num(3))
				randomize
				numm = cint(int((rnd * i) + 1))
			Loop
		end if   

		if x = 5 then 
			Do Until (numm <> num(1) and numm <> num(2) and 
numm <> num(3) and numm <> num(4))
				randomize
				numm = cint(int((rnd * i) + 1))
			Loop
		end if   
			
		num(x) = numm

	next 

	banneradID1 = banneradID(num(1))
    link1 = link(num(1))
	bannerad1 = bannerad(num(1))
	if len(link1) > 5 then  
		output1 = "<a href=" & link1 & " target='_blank'><img 
src='../bannerads/" & bannerad1 & "' width='126' height='270' 
border='0'></a>"
	else 
		output1 = "<img src='../bannerads/" & bannerad1 & "' 
width='126' height='270' border='0'>"
	end if 
	
	banneradID2 = banneradID(num(2))
    link2 = link(num(2))
	bannerad2 = bannerad(num(2))
	if len(link2) > 5 then  
		output2 = "<a href=" & link2 & " target='_blank'><img 
src='../bannerads/" & bannerad2 & "' width='126' height='270' 
border='0'></a>"
	else 
		output2 = "<img src='../bannerads/" & bannerad2 & "' 
width='126' height='270' border='0'>"
	end if 

	banneradID3 = banneradID(num(3))
    link3 = link(num(3))
	bannerad3 = bannerad(num(3))
	if len(link3) > 5 then  
		output3 = "<a href=" & link3 & " target='_blank'><img 
src='../bannerads/" & bannerad3 & "' width='126' height='270' 
border='0'></a>"
	else 
		output3 = "<img src='../bannerads/" & bannerad3 & "' 
width='126' height='270' border='0'>"
	end if 

	banneradID4 = banneradID(num(4))
    link4 = link(num(4))
	bannerad4 = bannerad(num(4))
	if len(link4) > 5 then  
		output4 = "<a href=" & link4 & " target='_blank'><img 
src='../bannerads/" & bannerad4 & "' width='126' height='270' 
border='0'></a>"
	else 
		output4 = "<img src='../bannerads/" & bannerad4 & "' 
width='126' height='270' border='0'>"
	end if 

	banneradID5 = banneradID(num(5))
    link5 = link(num(5))
	bannerad5 = bannerad(num(5))
	if len(link5) > 5 then  
		output5 = "<a href=" & link5 & " target='_blank'><img 
src='../bannerads/" & bannerad5 & "' width='126' height='270' 
border='0'></a>"
	else 
		output5 = "<img src='../bannerads/" & bannerad5 & "' 
width='126' height='270' border='0'>"
	end if 	

%>

AND

<%
cuID = request.cookies("cuID") 
if cuID = "" then cuID = 0 
sql = "select bannername,culink from creditunions where cuID=" & cuID
set bn = conn.execute(sql)

if not bn.eof then 
	bannerimage = bn("bannername")
	culink = bn("culink")
	cuhref = "<a href=" & culink & " target='_blank'>"
else 
	sql = "select defaultbanner,defaultlink from defaultbanner where 
bannertype='default'"
	set defaulttop = conn.execute(sql)
		bannerimage = defaulttop("defaultbanner")
		culink = defaulttop("defaultlink")
		cuhref = "<a href=" & culink & " target='_blank'>"
end if 
%>

=========================================================================
> So, after you run this page below, you can't run any other .asp page? Or 
you
can't connect to the database anymore? Can you show me the code of the 2nd
page that doesn't run anymore?

Also, what is in the page:
<!--#include file="../shared/connection.asp" -->

Secondly, you are closing your connection inside your If...End If
conditional, but you appear to be opening the connection outside the
conditional. You shoudl change your code so that it *always* closes the
connection (ie, move the code to close the connection to ourside the
conditional).

Cheers
Ken

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Omar Higgs" <ohiggs@n...>
Subject: [access_asp] Re: Access DB locking up/Connection problem


: HERE'S THE CODE THAT DOES THE UPDATE:
:
: <!--#include file="../shared/connection.asp" -->
: <%
: banneradID = request("banneradID")
: divisionID = request("divisionID")
: action = request("action")
: deaID = request("deaID")
: if deaID = "" then deaID = 0
: bactive = request("bactive")
: if bactive = "Yes" then
: bactive = 1
: else
: bactive = 0
: end if
:
: link = request("link")
:
: if link = "" then link = " "
:
: description = replace(request("description"),"'","''")
: if description = "" then description = " "
:
: bannertype = request("bannertype")
:
: if action = "update" then
:
: sql = "update bannerads set
:
bannertype='"&bannertype&"',bactive="&bactive&",link='"&link&"',description
: ='"&description&"',deaID="&deaID&",divisionID="&divisionID&" where
: banneradID=" & banneradID
: set rs = conn.execute(sql)
: conn.close
: set conn = nothing
: end if
:
:
: %>
:
:
:
:
: > Please post the code you are using.
:
: Cheers
: Ken
:
: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: From: "Omar Higgs" <ohiggs@n...>
: Subject: [access_asp] Re: Access DB locking up/Connection problem
:
:
: : No looping.  Just an update statement.
: :
: : At this point, I'm completely lost abou this problem.
: :
: : ----------------------
: : > Sounds like you have an infinite loop in your code (or something
: : similar).
: :
: : Cheers
: : Ken
: :
: : ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: : From: "Omar Higgs" <ohiggs@n...>
: : Subject: [access_asp] Access DB locking up/Connection problem
: :
: :
: : : I am writing to an Access database that site on a web server from 
ASP.
: : : I'm using a DSN-less connection for this.  Once I write to the
database
: I
: : : cannot establish ANY subsequent connections to it without hogging the
: : : server CPU.  I actually have to get the techs to kill the process and
I
: : : have to overwrite the DB with a backup before I can proceed.
: : :
: : : Using a DSN-less connection did not help at all. Could IIS or COM+ be
: the
: : : issue here?
: :
: : ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:

Message #9 by "Ken Schaefer" <ken@a...> on Tue, 12 Nov 2002 16:37:19 +1100
Omar,

Sorry to be a pain, but when you say "the other include files are", what are
these files? Where do they go?

Somewhere along the line there is a problem. But at the moment I can't see
where. It might be the first page that you are running (which you think is
causing a problem), or it might be the subsequent page that you are running
(when you think that the server is already broke).

At the moment, getting information out of you is like pulling teeth! :-)

Maybe we can start again. You run the first page.

a) Can you provide all the code on this page?
b) Does this page ever finish? (eg what happens if you put a
Response.Write("Done") at the end
c) What happens to the CPU utilisation? Does it get to 100% when you run
this page?

d) If the page above finishes, what happens when you run a second page? Does
the 2nd page have to connect to the database to cause the problem? or is in
any .asp page?

Cheers
Ken

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Omar Higgs" <ohiggs@n...>
Subject: [access_asp] Re: Access DB locking up/Connection problem


:
: 1) The connection.asp page is:
: <%
: connectionstring="dsn=abs"
: set conn = server.createobject("ADODB.Connection")
: conn.open connectionstring
:
: %>
: =========================================================================
: 2) The other include files are:


  Return to Index