Sqlite – locked database

Homepage Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Sqlite – locked database

  • Creator
    Topic
  • #51474
    David Harrison
    Participant

    I have a bi-directional ordercomms interface and I

Viewing 8 reply threads
  • Author
    Replies
    • #70437
      David Barr
      Participant

      You could probably use “catch”.

    • #70438
      James Cobane
      Participant

      You can use ‘catch’ along with a ‘while’ loop to keep trying until the DB is available; i.e.

      set retcd 1

      while {$retcd} {

    • #70439
      David Harrison
      Participant

      I’ve managed to find some information on the Sqlite website <a href="http://www.sqlite.org/tclsqlite.html#busy&#8221; class=”bbcode_url”>http://www.sqlite.org/tclsqlite.html#busy

      It suggests setting a timeout to wait a while until the db is hopefully unlocked or using the ‘busy’ method but it doesn’t give any examples. Is this where the catch command comes in?

    • #70440

      Right. In James’ example above, the script will loop until the sql statement returns 1 (i.e., it ran successfully).

      -- Max Drown (Infor)

    • #70441
      David Harrison
      Participant

      I’ll run with that. Thanks

    • #70442
      Jim Kosloskey
      Participant

      It might be prudent to put some limit so that you do not end up in that loop endlessly (that would not be good).

      Of course then you need to determine what constitutes a prudent, useful limit.

      email: jim.kosloskey@jim-kosloskey.com

    • #70443
      David Harrison
      Participant

      That did occur to me so instead I’ve put in the line ‘db timeout 2000’ which, according to the documentation, should retry for 2 seconds during which time hopefully the database should no longer be locked. It seems the safer option as it’s a live ordercomms interface.

    • #70444

      David, how has this been working for you since you made your change?

      -- Max Drown (Infor)

    • #70445
      David Harrison
      Participant

      Max,

      It’s worked ok as I haven’t had any ‘database locked’ errors with the code I’ve implemented it in. I have had the problem arise with other procs so you’ve prompted me to make the changes elsewhere.

      Thanks,

      Dave

Viewing 8 reply threads
  • The forum ‘Cloverleaf’ is closed to new topics and replies.

Forum Statistics

Registered Users
5,053
Forums
28
Topics
9,236
Replies
34,175
Topic Tags
273