Jump to content

SQLite: lock on file not currently in use


Recommended Posts

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 by osvaldo
Link to post
  • osvaldo changed the title to SQLite: lock on file not currently in use

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.

Link to post

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 !:D

Link to post

Damn! You are right! :o
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!:oops:)
I was concentrating on closing the file when the problem occurred an hour before it was created!:(
 

Thank you so much again!:thumbup1::beer_mug:

Osvaldo

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.