Thread: [SQLObject] Database is locked
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: vishnu <ckm...@gm...> - 2008-02-04 09:17:50
|
Hi, Im currently using 0.9.2 version SQLObject in my CentOS5.1 system. Im using SQLObject in a multi-threaded application. I have my own mutex lock to prevent more than one write operation. No restrictions in application for Read operation. My problem is that i get occational "Database is locked error". Im not sure as to the cause of this issue. is there a way to give a timeout to wait for lock release. can anyone help, I dont find any help in SQLObject site about any syntax on timeout please help -- Vishnu, Developer, B I N A R Y K A R M A, Mobile : +91-9994475599 Tel : 044-64621656 email: vi...@bi... "A husband and wife are like clothes for each other, Those among you are the best who are good to their wives". - Muhammad, the final Prophet (peace be upon him) |
From: Jorge G. <jg...@gm...> - 2008-02-04 10:05:13
|
vishnu wrote: > Hi, > Im currently using 0.9.2 version SQLObject in my CentOS5.1 system. > > Im using SQLObject in a multi-threaded application. I have my own mutex > lock to prevent more than one write operation. No restrictions in > application for Read operation. Why can't you let the database server take care of locking things as needed? I have applications used by multiple users in multiple processes (web) and the database does all what is needed. It really feels like if there were several desktop applications and all of them worked simultaneously. > My problem is that i get occational "Database is locked error". > > Im not sure as to the cause of this issue. is there a way to give a > timeout to wait for lock release. It should probably be a problem in your locking mechanism... > I dont find any help in SQLObject site about any syntax on timeout Google give some hints of using other modules to have this implemented. But I still believe that it would be better to let the database handle that. |
From: Oleg B. <ph...@ph...> - 2008-02-04 15:57:44
|
On Mon, Feb 04, 2008 at 02:47:48PM +0530, vishnu wrote: > My problem is that i get occational "Database is locked error". By this error I can guess you are using SQLite as the backend. I don't know a way to fix or overcome the problem with SQLite. I have been developing a few commercial programs that use SQLObject. For small customer where there are only 1 or 2 clients applications I use SQLite as the backend. But for larger installations where I need to install more client applications connected to one backend I use a real database server. I use PostgreSQL but you can use whatever suites your needs - PostgreSQL or MySQL, e.g. Oleg. -- Oleg Broytmann http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Nick M. <nmu...@lo...> - 2008-02-04 16:37:09
|
> By this error I can guess you are using SQLite as the backend. I don't > know a way to fix or overcome the problem with SQLite. You can "fix" the broken database by using sqlite's `.output FILENAME` followed by `.dump` to output all the data, then read it back into a blank sqlite database with `sqlite newdatabase.sqlite < FILENAME`. These sort of problems are why I started just using a test psql database for developing with, rather than sqlite :) |
From: Leandro L. <ll...@gm...> - 2008-02-04 18:10:01
|
Oleg Broytmann, el 4 de febrero a las 18:57 me escribiste: > On Mon, Feb 04, 2008 at 02:47:48PM +0530, vishnu wrote: > > My problem is that i get occational "Database is locked error". > > By this error I can guess you are using SQLite as the backend. I don't > know a way to fix or overcome the problem with SQLite. There is a parameter to SQLite to wait for the lock for a while. Just pass timeout=something when creating the SQLite connection, for example: sqlite:///....?timeout=5000 If you want it to wait 5 seconds before raising the database locked exception. It seems that this parameter is still undocumented :) -- Leandro Lucarella (luca) | Blog colectivo: http://www.mazziblog.com.ar/blog/ ---------------------------------------------------------------------------- GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145 104C 949E BFB6 5F5A 8D05) ---------------------------------------------------------------------------- CHINO ATRAPA COTORRAS -- Crónica TV |
From: Oleg B. <ph...@ph...> - 2008-02-04 20:41:38
|
On Mon, Feb 04, 2008 at 04:07:38PM -0200, Leandro Lucarella wrote: > Oleg Broytmann, el 4 de febrero a las 18:57 me escribiste: > > On Mon, Feb 04, 2008 at 02:47:48PM +0530, vishnu wrote: > > > My problem is that i get occational "Database is locked error". > > > > By this error I can guess you are using SQLite as the backend. I don't > > know a way to fix or overcome the problem with SQLite. > > There is a parameter to SQLite to wait for the lock for a while. Just pass > timeout=something when creating the SQLite connection, for example: > sqlite:///....?timeout=5000 > If you want it to wait 5 seconds before raising the database locked > exception. It never helped me. Probably I had been doing something wrong. Oleg. -- Oleg Broytmann http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |