Página 1 de 1
Sqlite : Concurrent User Problem
Publicado: Mié Mar 25, 2015 3:38 pm
por Milan Mehta
What is the standard procedure to be followed in the cases where concurrent users try to save data in Sqlite database ?
Quite often we get the error : Database is locked [#5].
TIA
Milan.
Sqlite : Concurrent User Problem
Publicado: Jue Mar 26, 2015 10:17 am
por ignacio
Hello,
SQLite always locks the complete database on every update operation. In order to reduce your problem I suggest the following:
1) Use always transactions
2) Use Memdatasets instead of SQLite datasets when no edit is needed. Since sort & filter operations are done internally
3) Set oSqlite:lAllowProcessMessages to false
Regards,
Sqlite : Concurrent User Problem
Publicado: Mié Abr 01, 2015 2:20 pm
por emeasoft
Bom dia,
Estamos migrando de DBF para SQLite e encontramos o mesmo problema de compartilhamento do banco de dados quando o
sistema está rodando em rede.
Para solucionar isto desenvolvemos a rotina abaixo que funciona igual ao Flock e Neterr:
No início do aplicativo:
::oSQLite:cConnect:="TESTE.bd"
::oSQLite:lConnected :=.T.
::oSQLite:lAbortOnErrors:=.F.
::oSQLite:lAllowProcessMessages:=.T.
::oSQLite:lDisplayErrors:=.F.
::oSQLite:lReadToCache := .T.
::oSQLite:cPassword:="123456"
::oSQLite:Execute("PRAGMA busy_timeout = 5000")
Nas rotinas:
DO WHILE .T.
::oLabel:cText:="Aguardando gravação...."
IF !::oSQLite:lConnected
::oSQLite:lConnected :=.T.
ENDIF
::oSQLite:Execute("REPLACE INTO ......
IF !::oSQLite:IsError()
::oLabel:cText:="Gravado...."
EXIT
ELSE
::oSQLite:DelErrors()
Sleep(200)
ENDIF
ENDDO
Aguardamos novas soluçíµes se existir.
Abraços
Mário Angelini
Sqlite : Concurrent User Problem
Publicado: Mié Abr 01, 2015 8:00 pm
por emeasoft
Hello Xailers,
Is there a way to change the locktype or lock only the table?
Because we can't even use a "select" when updating a table.... the entire database is locked.
TIA,
Juliano