I had this problem when adding the 2nd record to a table using crud
and sqlite3.
Then I saw this posting
http://groups.google.com/group/web2py/browse_thread/thread/ff93d18db6d4ed53/bc1f44c0cc0f50a3?lnk=gst&q=database+is+locked#bc1f44c0cc0f50a3
where Massimo suggests trying db.commit()
I put a db.commit() call in my controller and it solved the problem.
My controller:
from gluon import *
from gluon.tools import Crud
from gluon.globals import *
def index():
crud = Crud(globals(), db_invoice)
formForInsert = crud.create(db_invoice.customer)
formForRead = crud.select(db_invoice.customer)
db_invoice.commit()
return
dict(formForInsert=formForInsert,formForRead=formForRead,customers=plugin_editable_jqgrid(db_invoice.customer))
On May 23, 6:40 am, Michele Comitini <[email protected]>
wrote:
> Yes it is a problem with sqlite you have anoter process locking the db.
>
> mic
>
> 2011/5/23 Pablo Angulo <[email protected]>:
>
>
>
>
>
>
>
> > Hello: I'm working on a cron job that must write to thedatabase: is
> > this allowed? I don't know if the following error is sqlite only:
>
> > File "web2py/gluon/dal.py", line 4487, in insert
> > return self._db._adapter.insert(self,self._listify(fields))
> > File "web2py/gluon/dal.py", line 772, in insert
> > raise e
> > pysqlite2.dbapi2.OperationalError:databaseislocked
>
> > Regards