SQLite

SQLite Start Guide

1. Prerequisites

  • Have Node.js (version 14 or later) and npm installed. Some instructions are available here.
  • Configure the sqltools.useNodeRuntime setting. It can be set to true to perform auto-detect of your Node runtime, or to the full path of the runtime.
    • For successful auto-detect on Windows we recommend that VS Code is be configured to use PowerShell as its default terminal shell. If set to Command Prompt or Windows PowerShell, auto-detect may fail.
    • An example of a string value for a Windows environment is "C:\\Program Files\\nodejs\\node.exe". Notice how backslashes in a JSON string have to be doubled.
// settings.json example
{
  "sqltools.useNodeRuntime": true
}

Upon first use the SQLite driver extension prompts for permission to install the node-sqlite3@5.1.1 package. During installation this package downloads its platform-specific prebuilt binaries. See the package documentation for details.

2. Connections

2.1 SQLite’s Easy Connect Syntax

SQLite’s connections handle files so you can use the example below as reference to connect to your database file:

{
  "name": "SQLite",
  "driver": "SQLite",
  "database": "./sqlite/test_db.db", // if you use a relative path the base folder is the currently open folder (or workspace).
  "connectionTimeout": 15
}