Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Nov 2002
    Posts
    70
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question db connection not closed?

    Hi,

    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

  • #2
    Regular Coder
    Join Date
    Jul 2004
    Location
    France
    Posts
    141
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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
    con.open
    End Sub

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

    or

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

    same thing for recordset

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

  • #3
    New Coder
    Join Date
    Nov 2002
    Posts
    70
    Thanks
    0
    Thanked 0 Times in 0 Posts

    connection closed

    I have tried it out, thanks.

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

    Any idea?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •