// free tool

SQLite connection string builder

Build SQLite connection strings for Microsoft.Data.Sqlite, JDBC, SQLAlchemy, Python and Node from a file path, or paste a URI filename or Data Source string to see what each option does. It all runs in your browser: nothing you type is sent anywhere.

Open this connection in SQLly

Opens SQLly's connection editor filled in.

Private by design. The builder and decoder are plain JavaScript running in this tab. The page sends no request with what you type, stores nothing (not even in your browser), and keeps working offline once loaded. The Open in SQLly link goes from your browser straight to the app on your computer.

SQLite connection string formats

A SQLite "connection string" is mostly a file path, but every wrapper dresses it differently: Data Source=app.db in .NET, jdbc:sqlite:/path in Java, sqlite:////abs/path.db (four slashes) in SQLAlchemy. SQLite's own URI filenames (file:app.db?mode=ro) add options such as read-only mode, but only when the caller enables URI handling.

File path sqlite3 CLI, most drivers, SQLly

/var/data/app.db

URI filename (read-only) SQLite URI filenames

file:///var/data/app.db?mode=ro

ADO.NET Microsoft.Data.Sqlite, EF Core

Data Source=/var/data/app.db;Mode=ReadOnly

JDBC xerial sqlite-jdbc

jdbc:sqlite:/var/data/app.db

SQLAlchemy URL Python SQLAlchemy

sqlite:////var/data/app.db

Placeholders such as your_password are just that: build your own string with the form above. More about connecting SQLly to SQLite: SQLly for SQLite.

SQLite URI filename parameters

The scheme is file:; the authority must be empty or localhost, so file:/abs/path, file:///abs/path and file://localhost/abs/path are all the same file. Encode ? as %3F and # as %23 in the path. URI handling is off by default: enable it with SQLITE_OPEN_URI, uri=True in Python, or your wrapper's equivalent.

KeywordSynonymsDefaultWhat it does
mode - rwc ro read-only, rw read-write (must exist), rwc read-write-create, memory in-memory.
cache - private shared lets connections in one process share a cache.
immutable - 0 1 promises the file never changes: no locking at all. Corrupt reads if anyone does write.
nolock - 0 1 disables file locking.
vfs - default VFS Name of the VFS module to use.
psow - build default Powersafe overwrite.

Microsoft.Data.Sqlite keywords

ADO.NET style. Data Source may also be a URI filename.

KeywordSynonymsDefaultWhat it does
Data Source DataSource, Filename empty (temporary on-disk database) File path, :memory:, or a URI filename.
Mode - ReadWriteCreate ReadWriteCreate, ReadWrite, ReadOnly, Memory.
Cache - Default Default, Private, Shared.
Password - - Sends PRAGMA key; needs an encryption-capable build such as SQLCipher.
Foreign Keys - empty (no pragma) True turns on PRAGMA foreign_keys.
Recursive Triggers - False PRAGMA recursive_triggers.
Default Timeout Command Timeout 30 6.0+. Seconds; also how long to wait on a locked database.
Pooling - True 6.0+. Connection pooling.

Common SQLite connection errors

unable to open database file

Why: SQLITE_CANTOPEN: the directory does not exist, the process cannot write to the directory (SQLite needs to create journal files next to the database), a relative path resolved against an unexpected working directory, or ~ was used (SQLite does not expand it).

Fix: Use an absolute path, create the directory, and give the process write access to the directory, not just the file.

database is locked

Why: SQLITE_BUSY: another connection holds a write lock and this one did not wait long enough.

Fix: Set a busy timeout (Default Timeout in Microsoft.Data.Sqlite, timeout in Python, busy_timeout pragma), keep write transactions short, and consider PRAGMA journal_mode=WAL for concurrent readers.

attempt to write a readonly database

Why: The file or its directory is read-only for this process, or it was opened with mode=ro / Mode=ReadOnly.

Fix: Fix the permissions on the file and its directory, or open read-write.

file is not a database

Why: SQLITE_NOTADB: the file is not SQLite (for example a DuckDB file), is encrypted with a key you did not supply, or is damaged.

Fix: Check what the file is (file app.db on macOS/Linux) and open it with the right engine or key.

SQLite connection string FAQ

What is the SQLite connection string?

Usually just the file path. In .NET it is Data Source=/path/app.db, in Java jdbc:sqlite:/path/app.db, in SQLAlchemy sqlite:////path/app.db for an absolute path (sqlite:///app.db for a relative one).

How do I open a SQLite database read-only?

Use a URI filename with mode=ro (file:/path/app.db?mode=ro, with URI handling enabled), Mode=ReadOnly in Microsoft.Data.Sqlite, open_mode=1 in sqlite-jdbc, or readonly: true in better-sqlite3.

How do I create an in-memory SQLite database?

Use :memory: as the path. Each connection gets its own private database unless you use a shared-cache URI such as file::memory:?cache=shared.

Why four slashes in a SQLAlchemy SQLite URL?

sqlite:// is the scheme and the empty host, the third slash ends the host part, and the rest is the path. An absolute path starts with its own slash, so /var/data/app.db becomes sqlite:////var/data/app.db.

// skip the strings entirely

Connect once. Then just write SQL.

SQLly is a native SQL workbench for macOS, Windows and Linux. Paste a connection string into its connection editor, keep passwords in your system keychain, and get schema-aware IntelliSense on SQLite and more.