Hello, Wanted to understand the sqlite database lock a little better. Especially while using perl DBI-sqlite module.
I did some tests and wanted to know if this is a known way of sqlite's working. I have a perl script that add numbers 1-1000 into a db. Here is the code: ========================= use DBI; my $number; for ($number=0;$number <= 1000;$number++) { my $dbh = DBI->connect("dbi:SQLite:dbname=/opt/test.db","","", {RaiseError => 1, AutoCommit => 0}); $dbh -> do("INSERT INTO test1 VALUES('$number')"); $dbh -> commit(); $dbh->disconnect(); }; ============================ Tests: Test 1. When two instances of the script are run at the same time (from two different terminals), the update gets done. Though, there is a delay in the second instance and finishes after the first one is done. Test 2. Run one instance of the script and try to add to the db from the sqlite3 command line (at the same time), I get "database locked" message. Test 3. Run one instance of the script and simultaneously do a "select * test1" from the command line, it does not show all the rows in the database. I plan to use Apache+Perl+Sqlite to build a website that has about 100 users updating the db through the browser. I am using Sqlite 3.6.16 on RHEL. Question 1: Do i need to worry about retry mechanism for "sqlite_busy or database locked" scenarios. I do not intend to use the sqlite3 command line for making updates. Question 2: Is there a way to check if the database is busy or locked while using Perl DBI? Any pointers and sample code will help me immensely. Thanks in advance. Regards, Akash _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users