View Full Version : db connection not closed?

01-30-2005, 09:42 AM

I have a very strange situation.
I have an access database that is writable through web pages.
I can see that once the database is in localhost (my pc), after the webpage is loaded, the file*.ldb is opened and closed.
But when the file is on the webserver, it is never closed.
And when I open it to edit, and close it, the ldb is closed then, but then again it is re-opened when the webapge which write to is used, and the ldb is never closed.
Why is it different on localhost then on the webserver?

I have another writable database, wherer I am the only one who access the web page to write to it, but it is readable by users all the time.
Again, once I open a webpage that only reads from it, the ldb is opened and is never closed.

Before we switched to a new server we never had such problems, and the ldb's were opened and closed all the time.

Also, it seems that it causes failure on the website because of that.
Is there some definition on the server that can cause the database npt to bt closed?

Actually, when we use one server the website does not fail, but when we use replication, thus working with two servers, and files that were changed in server a, are copied to server b.
The above databses are not part of the website, so they are never replicated, bacause they are writable, so there is one copy for each, but only when replicating - the website fails. What can be the reason for that?

I am very sure the connections are closed.
Btw - Is there a way to test if the connections are closed,
and response.write this status?

Thanks for answering any part of the above questions

02-01-2005, 08:41 AM
you can use sub to ensure they are either close or open

Sub OpenCon
if isObject(con) then
set con= nothing
End if
set con=server.CreateObject("adodb.connection")
con.ConnectionString = conStr
End Sub

Sub CloseCon
on Error Resume next
if con.State > 0 then
end if
End Sub


Sub EndCon
on Error Resume next
if con.State > 0 then
end if
set con = Nothing
End Sub

same thing for recordset

Sub EndRs
on Error Resume next
if rs.State > 0 then
end if
set rs = Nothing
End Sub

05-31-2005, 01:17 PM
I have tried it out, thanks.

The connections are closed according to that,
and still, The *.ldb file stays open forever.

Any idea?