I've recently developed a webapp with pure go, session
handling from beego and sql support by go-sqlite3 from
mattn. Right after the I've coded the first method that needed to
make more than one db access I've got the following error:
2014/02/26 21:13:44 Internal error. [database is locked []]
I've checked a lot the I had closed all queries and rows but
couldn't find any error. After some research I've found the
following bug entry: https://github.com/mattn/go-sqlite3/issues/39
It basically said that the simple open method of the database was
wrong. So instead of
db, err := sql.Open("sqlite3", "file:./data.db")
I should have done
db, err := sql.Open("sqlite3",
"file:./data.db?cache=shared&mode=rwc")
After that change I could access the db more than once per method.