views:

459

answers:

2

I get "database table is locked" error in my sqlite3 db. My script is single threaded, no other app is using the program (i did have it open once in "SQLite Database Browser.exe"). I copied the file, del the original (success) and renamed the copy so i know no process is locking it yet when i run my script everything in table B cannot be written to and it looks like table A is fine. Whats happening?

-edit- I fixed it but unsure how. I notice the code not doing the correct things (i copied the wrong field) and after fixing it up and cleaning it, it magically started working again.

-edit2-

Someone else posted so i might as well update. I think the problem was i was trying to do a statement with a command/cursor in use.

+3  A: 

Maybe your application terminated prematurely after a SQLite transaction began. Look for stale -journal files in the directory and delete them.

It might be worth skimming through the documentation as well.

codelogic
A: 

Deleting -journal files sounds like bad advice. See this explanation.

Aaron