Skip to content

CLI

Connections and Passwords

dbcode connections lists every saved connection with a cli column that says ok or why the CLI cannot open it. The CLI opens PostgreSQL, CockroachDB, MySQL, MariaDB, SQL Server, MongoDB and SQLite connections. Connections that use an SSH tunnel, a cloud provider or an authentication profile are listed but cannot be opened from the CLI.

SQLite needs the database engine that DBCode downloads the first time you open a SQLite connection in the editor. If the CLI reports it missing, open any SQLite connection once.

The CLI honours the “Save password” choice on each connection.

  • Secret storage (the default): the CLI reads the password your editor saved. On macOS this shows a Keychain prompt the first time, from the security tool, for the item named Code Safe Storage (or Cursor Safe Storage and so on). Click Always Allow to stop it asking. On Windows it is silent. On Linux it works with the basic password store and with an unlocked desktop keyring.
  • Encrypted: you are asked for the encryption passphrase.
  • Session and Prompt each time: you are asked for the password.
  • Command: the command runs after you approve it, or with --yes.

Prompts go to your terminal, never to stdin, so they work while SQL is piped in. Without a terminal, a connection that needs a prompt fails with exit code 3 and a message saying why.