conn.close() but MS Access .laccdb (lock) file stays open #1280
Replies: 6 comments 1 reply
-
Does the .laccdb file remain if you simply open the connection, wait a couple of seconds, and then close the connection? import time
import pyodbc
connection_string = "Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=…"
cnxn = pyodbc.connect(connection_string)
sleep_time = 3
print(f"Connected. Pausing for {sleep_time} seconds.")
time.sleep(sleep_time)
print("Closing connection.")
cnxn.close() |
Beta Was this translation helpful? Give feedback.
-
It may be a driver bug, could you post an ODBC trace? The driver is supposed to cleanup upon connection close but perhaps it isn't doing that. |
Beta Was this translation helpful? Give feedback.
-
Also, when you say "At end conn.close()" does it mean that your script terminates immediately after the |
Beta Was this translation helpful? Give feedback.
-
Yes and I'm trying your suggestion to put a short sleep after the close. |
Beta Was this translation helpful? Give feedback.
-
FWIW, I am unable to reproduce your issue with ACE for Access 2013 and an .accdb on my local hard drive. The .laccdb file is removed within one second of calling |
Beta Was this translation helpful? Give feedback.
-
Aha! Dropbox folder.
BTW still have not had time to test with new pause-code you recommended.
Sincerely,
Scott Swain
https://OceanMedia.net
Sent with [Proton Mail](https://proton.me/) secure email.
…------- Original Message -------
On Monday, September 25th, 2023 at 14:49, Gord Thompson ***@***.***> wrote:
FWIW, I am unable to reproduce your issue with ACE for Access 2013 and an .accdb on my local hard drive. The .laccdb file is removed within one second of calling .close() on the connection, even if the script continues to run. Is your.accdb on a network share, by chance?
—
Reply to this email directly, [view it on GitHub](#1279 (comment)), or [unsubscribe](https://github.com/notifications/unsubscribe-auth/AFBST3LNEOYY4UJUT3EQODDX4HN35ANCNFSM6AAAAAA5EIP52Y).
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Environment:
My issue:
Open database, read & write <-- all works fine.
At end conn.close()
.Laccdb file (MS Access lock file) stays visible in folder next to the .accdb file.
It's not a "slow" thing. I refresh, wait, etc. and that .Laccdb file is still there.
I can delete it manually but would like this to work the way it is supposed to.
Until I can figure out an elegant fix, I'll have my program delete the file.
Beta Was this translation helpful? Give feedback.
All reactions