This is probably really simple but I don't know how to fix.
I have two processes that access the same sqlite3 db file using php. Process 1
starts first and is loading data in spurts into the db. Process 2 cannot access
the db oto get data even when Process 1 is not doing anything. All file have
the same unix permissions and are running under user.
Any help would be appreciated
-rwxr-xr-x 1 user staff 5149 Nov 15 18:08 Process 2
-rw-rw-rw- 1 user staff 142910464 Nov 15 18:15 db.sql3
-rwxr-xr-x 1 user staff 7976 Oct 31 19:24 Process 1.php
PHP
$db_conn = new PDO('sqlite:'. 'db.sql3');
$db_conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
Process 1:
$sql = "INSERT INTO md5_sigs (date, md5, size, sig, filename, refnum) VALUES
($date, '$md5', $size, '$sig', '$name', '')";
$result = $db_conn->exec($sql);
$update_time = time();
$sql = "INSERT OR REPLACE INTO key_value (key, value) VALUES ('updated',
$update_time)";
$result = $db_conn->exec($sql);
Process 2:
$sql = "SELECT value FROM key_value WHERE key=='updated'";
$result = $db_conn->query($sql);
$row = $result->fetch();
$result->closeCursor();
if (empty($row)) $updated_time = 0;
never receives a value
$sigs_created = time();
$sql = "INSERT OR REPLACE INTO key_value (key, value) VALUES ('sigs_created',
$sigs_created)";
$result = $db_conn->exec($sql);
aborts with: SQLSTATE[HY000]: General error: 5 database is locked code:HY000
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users