Skip to content
jkpeng edited this page Apr 14, 2024 · 3 revisions

Getting insert error while query is opened.

> You can pass some arguments into the connection string, for example, a URI.
> See: [#39](https://github.com/mattn/go-sqlite3/issues/39)

Do you want to cross compile? mingw on Linux or Mac?

> See: [#106](https://github.com/mattn/go-sqlite3/issues/106)
> See also: http://www.limitlessfx.com/cross-compile-golang-app-for-windows-from-linux.html

Want to get time.Time with current locale

Use `_loc=auto` in SQLite3 filename schema like `file:foo.db?_loc=auto`.

Can I use this in multiple routines concurrently?

Yes for readonly. But, No for writable. See [#50](https://github.com/mattn/go-sqlite3/issues/50), [#51](https://github.com/mattn/go-sqlite3/issues/51), [#209](https://github.com/mattn/go-sqlite3/issues/209), [#274](https://github.com/mattn/go-sqlite3/issues/274).

Why I'm getting no such table error?

Why is it racy if I use a `sql.Open("sqlite3", ":memory:")` database?

Each connection to :memory: opens a brand new in-memory sql database, so if
the stdlib's sql engine happens to open another connection and you've only
specified ":memory:", that connection will see a brand new database. A
workaround is to use "file::memory:?mode=memory&cache=shared". Every
connection to this string will point to the same in-memory database. 

For more information see
* [#204](https://github.com/mattn/go-sqlite3/issues/204)
* [#511](https://github.com/mattn/go-sqlite3/issues/511)

Reading from database with large amount of goroutines fails on OSX.

OS X limits OS-wide to not have more than 1000 files open simultaneously by default.

For more information see [#289](https://github.com/mattn/go-sqlite3/issues/289)

Trying to execure a . (dot) command throws an error.

Error: `Error: near ".": syntax error`
Dot command are part of SQLite3 CLI not of this library.

You need to implement the feature or call the sqlite3 cli.

More infomation see [#305](https://github.com/mattn/go-sqlite3/issues/305)

Error: database is locked

When you get an database is locked. Please use the following options.

Add to DSN: cache=shared

Example:

db, err := sql.Open("sqlite3", "file:locked.sqlite?cache=shared")

Second please set the database connections of the SQL package to 1.

db.SetMaxOpenConn(1)

Error: database is locked (5) (SQLITE_BUSY) with Microsoft SMB Protocol

When you're developing on Windows, SMB sharing files, and running code on virtual machines Configure the Example:

- map: E:/gocode
      to: /home/vagrant/gocode
      type: "smb"

Example database path "/home/vagrant/gocode/db.sqlite3"

Move the database file to a non-SMB path Example :

mv /home/vagrant/gocode/db.sqlite3 /home/vagrant/db

More information see #209