Skip to main content
The connect command manages your database connections. Queryly stores connection information securely in ~/.queryly/connections.json (or C:\Users\<username>\.queryly\ on Windows).

Subcommands

connect add

Add a new database connection interactively. The connection is tested before saving.
queryly connect add
Interactive Prompts:
name
string
required
Friendly name for the connection (e.g., “LocalDB”, “ProductionDB”)
type
enum
required
Database type selection:
  • SQLite
  • PostgreSQL
  • MySQL
  • SQL Server
connectionString
string
required
Database-specific connection string (see Connection Strings)
Example:
$ queryly connect add
Connection name: MyApp
Select database type: SQLite
Connection string: Data Source=./myapp.db
 Connection successful!
 Saved connection 'MyApp'
The connection is automatically tested before saving. If the test fails, the connection will not be saved.

connect list

Display all saved database connections with their metadata.
queryly connect list
Output:
┌─────────────┬──────────────┬──────────────────┬──────────┐
│ Name        │ Type         │ Last Used        │ Favorite │
├─────────────┼──────────────┼──────────────────┼──────────┤
│ MyApp       │ SQLite       │ 2024-03-15 14:30 │          │
│ DevDB       │ PostgreSQL   │ 2024-03-15 10:15 │ ⭐       │
│ LocalSQL    │ SQLServer    │ 2024-03-14 16:45 │          │
└─────────────┴──────────────┴──────────────────┴──────────┘
Columns:
  • Name: The friendly name you assigned
  • Type: Database type (SQLite, PostgreSQL, MySQL, SQLServer)
  • Last Used: Timestamp when the connection was last accessed
  • Favorite: Star (⭐) indicates favorited connections
If you have no connections saved, you’ll see a helpful message:
No connections found.
Use queryly connect add to add a connection.

connect test

Test an existing connection to verify it’s still working.
queryly connect test <name>
name
string
required
The name of the connection to test
Examples:
# Test a connection
$ queryly connect test MyApp
Testing connection...
 Connection successful!
# Test fails if connection is invalid
$ queryly connect test OldDB
Testing connection...
 Connection test failed!
# Connection not found
$ queryly connect test NonExistent
 Connection 'NonExistent' not found.
Connection tests open a real connection to your database. Make sure the database is accessible and credentials are current.

connect remove

Remove a saved database connection after confirmation.
queryly connect remove <name>
name
string
required
The name of the connection to remove
Example:
$ queryly connect remove OldDB
Connection: OldDB
Type: SQLite
Last used: 2024-01-10 08:30

Remove 'OldDB'? (yes/no): yes
 Removed connection 'OldDB'
Cancellation:
$ queryly connect remove MyApp
Connection: MyApp
Type: SQLite
Last used: 2024-03-15 14:30

Remove 'MyApp'? (yes/no): no
Cancelled.
You’ll be shown connection details and asked to confirm before deletion. Type yes to confirm or no to cancel.

Connection Strings

Connection string formats vary by database type:
Format:
Data Source=path/to/database.db
Examples:
# Local file
Data Source=./mydb.db
Data Source=/home/user/databases/app.db

# In-memory database
Data Source=:memory:

# Read-only mode
Data Source=mydb.db;Mode=ReadOnly
Supported Features:
  • ✅ Connection management
  • ✅ Schema exploration
  • ✅ Table browsing
  • ✅ Query execution
  • ✅ Data export

Configuration Storage

Connections are stored in a JSON file: Location:
  • macOS/Linux: ~/.queryly/connections.json
  • Windows: C:\Users\<username>\.queryly\connections.json
Example structure:
{
  "connections": [
    {
      "id": "abc123...",
      "name": "LocalDB",
      "dbType": "SQLite",
      "connectionString": "Data Source=./myapp.db",
      "lastUsed": "2024-03-15T14:30:00Z",
      "isFavorite": false,
      "metadata": {}
    }
  ],
  "activeConnectionId": "abc123..."
}

Error Messages

ErrorMeaningSolution
Connection test failedDatabase is unreachable or credentials are wrongVerify connection string, check database is running
Connection 'name' not foundNo connection exists with that nameUse connect list to see available connections
Invalid data commandIncorrect subcommand syntaxCheck command format: connect <subcommand>

Next Steps

Explore Schema

Use schema commands to explore your database structure

Browse Data

Use data commands to view and query your data

Build docs developers (and LLMs) love