osvaldo Posted March 18, 2021 Report Share Posted March 18, 2021 (edited) Good evening everyone. I have a problem with SQLite file locks ... I created a datalogger in Labview that saves the data acquired from a customer's custom equipment in an SQLite database. I used Powell's library (an egregious library!) Although the capture is continuous, the data is not stored in a single SQLite file but on different files lasting about 1 hour each. At each time change the software closes the database currently in use (with SQLite Close) and create a new one. The database reference remains open all the time until it is closed at the next hour change. These SQLite files are downloaded from another application running on a second PC using FTP. (the machine running the data logger has a FileZilla server) What happens is that it is not possible to download any SQLite file created by the data logger until the application is stopped! By stopping the application and restarting it, you can download all the files created before the restart but not those created afterwards! It is as if a lock is maintained on all files created until the program is closed! I would expect the lock to be present on the file currently in use, but not on those already closed. Has anyone experienced this behavior before? Thanks for any help you can give me. Osvaldo Edited March 18, 2021 by osvaldo Quote Link to comment
drjdpowell Posted March 18, 2021 Report Share Posted March 18, 2021 Do you check for an error coming out of SQLite Close? SQLite will not close and throw an error if unfinalized Statements exist on that connection. The unclosed connection would then continue to exist till your app is closed. Quote Link to comment
osvaldo Posted March 19, 2021 Author Report Share Posted March 19, 2021 Thanks for getting back to me so quickly! 🙂 In fact I haven't checked ... I hadn't thought about the possibility that the last insert query might not have ended when the Close was executed. I do some tests and check for any errors. Thank you so much ! Quote Link to comment
osvaldo Posted March 19, 2021 Author Report Share Posted March 19, 2021 Damn! You are right! When I create the new file I run 3 insert queries to set some default values in the tables. In the last of these queries the VI Finalize was missing and remained open! (damn copy and paste!) I was concentrating on closing the file when the problem occurred an hour before it was created! Thank you so much again! Osvaldo Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.