[Haskell-cafe] HDBC SQLite error

Alexander Danilov alexander.a.danilov at gmail.com
Tue Nov 1 19:03:26 CET 2011


01.11.2011 20:30, Jurriën Stutterheim пишет:
> Hi all,
>
>
> I have recently switched one of my web applications to SQLite via HDBC. I use it to store some user credentials and data. Initially it seemed to work fine, until I tried logging in from two different browsers. That's when I got the following error when trying to log in:
>
> SqlError {seState = "", seNativeError = 5, seErrorMsg = "step: database is locked"}
>
> My application only uses two functions (query and query', see [1]) directly, and the authentication code[2] uses HDBC directly. I'm not sure why I'm getting this error, because as far as I can see, I'm not keeping any transactions open longer than I have to in the auth code. Does anyone have an idea what might be wrong and how to fix it?
>
>
> Cheers,
>
>

This is a problem of hdbc-sqlite package, author think, than it can't work correctly without open 
transaction, so just commit after open database or modify hdbc-sqlite like this:

--- a/Database/HDBC/Sqlite3/Connection.hs
+++ b/Database/HDBC/Sqlite3/Connection.hs
@@ -75,7 +75,7 @@ genericConnect strAsCStrFunc fp =
  mkConn :: FilePath -> Sqlite3 -> IO Impl.Connection
  mkConn fp obj =
      do children <- newMVar []
-       begin_transaction obj children
+--       begin_transaction obj children
         ver <- (sqlite3_libversion >>= peekCString)
         return $ Impl.Connection {
                              Impl.disconnect = fdisconnect obj children,




More information about the Haskell-Cafe mailing list