Sorry for top-posting...

What's running on the the server?  A Perl CGI script?  Apache HTTPD?  mod-perl?

Is the AJAX exchange asyncronous?  Are you sure the first AJAX exchange is 
finished when the second one fires?  Does the AJAX request wait for a 200 
response?

Assuming Perl, are you explicitly closing the DB with  $dbh->disconnect (as 
opposed to $dbh = undef)?  Does the script end with an exit instruction?  I'm 
guessing you're sure there's no writer or writers that jumped-in.  Are you 
doing anything like modifying the default 30 second busy_timeout?  Perhaps to 
too short a timeout?

Sometimes it's useful to $dbh->disconnect before you print the response.

I've seen this happen from time to time in my own environment.  It's annoying 
as hell.   It seems to always come down to when and how I disconnect from the 
DB file.  

I seldom see it in regular CGI scripts.  More often, I see it with 
mod_perl::PerlRun (I don't use mod_perl::Registry) when I open the $dbh in a 
module where $dbh is exported into the main package.

 -Clark



----- Original Message ----
From: P Kishor <punk.k...@gmail.com>
To: General Discussion of SQLite Database <sqlite-users@sqlite.org>
Sent: Fri, October 16, 2009 12:53:28 PM
Subject: [sqlite] suggestions for avoiding "database locked" on ajax

Yes, I know, if it "hurts when I press here," then I shouldn't "press
here," but, so it goes...

I have an account creation form -- users enter their email and their
desired username, and the form --

onblur from the username field, sends off an ajax request to see if
the desired username already exists in the db, and if yes, it sends
back a suggestion;

onblur from the email field, sends off an ajax request to see if the
email already exists in the db, and if yes...

If neither the username nor the email exist in the db, then the
application creates a record and informs the user of success. Except,
the previous ajax request (I am assuming it is the previous ajax
request from onblur event from the email field) has locked the
database, and the app returns an error that "the database is locked."

So, what suggestion might you all have for getting around this?



-- 
Puneet Kishor http://www.punkish.org
Carbon Model http://carbonmodel.org
Charter Member, Open Source Geospatial Foundation http://www.osgeo.org
Science Commons Fellow, http://sciencecommons.org/about/whoweare/kishor
Nelson Institute, UW-Madison http://www.nelson.wisc.edu
-----------------------------------------------------------------------
Assertions are politics; backing up assertions with evidence is science
=======================================================================
Sent from Madison, WI, United States
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to