Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access_asp thread: Closing Access databases when users exit


Message #1 by "Donald Pickering" <donpick1@h...> on Tue, 29 Jan 2002 04:33:37
When users exit my web page system, I notice the ldb files are still open.

How can I ensure the Access database is closed when users click on the 'x' 

in the upper right corner of the window of the web page?

Message #2 by btodd@a... on Thu, 31 Jan 2002 18:55:32
I use a different technique to get a similar result, though it MAY have 

performance issues on high-traffic sites. It works fine with Access on 

sites with 20-30 active users, but I haven't had a chance to try with more.



I open the database connection at the beginning of each page and close it 

at the end. 



I use a DSN-less connection like so:

'OPEN

Set objConnection = Server.CreateObject("ADODB.Connection")

DSNtemp="DBQ=<physical path to Access database>"

DSNtemp=DSNtemp & ";Driver={Microsoft Access Driver (*.mdb)}"

DSNtemp=DSNtemp & ";DriverID=25"

DSNtemp=DSNtemp & ";FIL=MS Access"

DSNtemp=DSNtemp & ";ImplicitCommitSync=Yes"

DSNtemp=DSNtemp & ";MaxBufferSize=512"

DSNtemp=DSNtemp & ";MaxScanRows=8"

DSNtemp=DSNtemp & ";PageTimeout=5"

DSNtemp=DSNtemp & ";SafeTransactions=0"

DSNtemp=DSNtemp & ";Threads=3"

DSNtemp=DSNtemp & ";UID=admin"

DSNtemp=DSNtemp & ";UserCommitSync=Yes"

objConnection.OPEN DSNtemp



and just disconnect like so:

'CLOSE

objConnection.Close

Set objConnection = nothing



Hope this helps - you can search the achive on "active 

session", "Session.Abandon" and "IsClientConnected" for some discussions 

on other possibilites.



 Bill

  Return to Index