Mark Robson
2006-03-19 19:15:10 UTC
Hi all,
I'm using Sqlite3 from PHP via PDO.
My application was working fine as long as there was only one process
accessing the database, then I ran two instances at once. Now one of the
processes is getting
"Error message: SQLSTATE[HY000]: General error: 5 database is locked"
when trying to execute a statement which modifies the database.
I understand that this is liable to happen, unless a timeout is set via
sqlite3_busy_timeout().
I have set this timeout using the $db->setAttribute(PDO::ATTR_TIMEOUT, 5.0)
however it's made absolutely no difference to the behaviour.
It's certainly not waiting 5 seconds before giving me this error, and it's
happening with exactly the same frequency as before. It's as if it's being
ignored.
I've stepped through PHP in the debugger (gdb) and it's definitely calling
sqlite3_busy_timeout with the appropriate parameters (5000 ms).
What else can I do to prevent this?
If the answer is "nothing", I'm going straight over to MySQL :)
Mark
I'm using Sqlite3 from PHP via PDO.
My application was working fine as long as there was only one process
accessing the database, then I ran two instances at once. Now one of the
processes is getting
"Error message: SQLSTATE[HY000]: General error: 5 database is locked"
when trying to execute a statement which modifies the database.
I understand that this is liable to happen, unless a timeout is set via
sqlite3_busy_timeout().
I have set this timeout using the $db->setAttribute(PDO::ATTR_TIMEOUT, 5.0)
however it's made absolutely no difference to the behaviour.
It's certainly not waiting 5 seconds before giving me this error, and it's
happening with exactly the same frequency as before. It's as if it's being
ignored.
I've stepped through PHP in the debugger (gdb) and it's definitely calling
sqlite3_busy_timeout with the appropriate parameters (5000 ms).
What else can I do to prevent this?
If the answer is "nothing", I'm going straight over to MySQL :)
Mark