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.
Interactive Prompts:
Friendly name for the connection (e.g., “LocalDB”, “ProductionDB”)
Database type selection:
SQLite
PostgreSQL
MySQL
SQL Server
Example:
SQLite
PostgreSQL
SQL Server
$ 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.
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 < nam e >
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 < nam e >
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:
SQLite
PostgreSQL
MySQL
SQL Server
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
Format: Host=localhost;Database=mydb;Username=postgres;Password=secret
Examples: # Local database
Host = localhost ; Database = myapp ; Username = postgres ; Password = mypass
# With port
Host = localhost ; Port = 5432 ; Database = myapp ; Username = postgres ; Password = mypass
# With SSL
Host = localhost ; Database = myapp ; Username = postgres ; Password = mypass ; SSL Mode=Require
# Remote database
Host = db.example.com ; Database = production ; Username = admin ; Password = secure123
Supported Features:
✅ Connection management
✅ Schema exploration
✅ Table browsing
✅ Query execution
✅ Data export
Format: Server=localhost;Database=mydb;User=root;Password=secret
Examples: # Local database
Server = localhost ; Database = myapp ; User = root ; Password = mypass
# With port
Server = localhost ; Port = 3306 ; Database = myapp ; User = root ; Password = mypass
# Remote database
Server = db.example.com ; Database = production ; User = admin ; Password = secure123
# With SSL
Server = localhost ; Database = myapp ; User = root ; Password = mypass ; SslMode = Required
Supported Features:
✅ Connection management
✅ Schema exploration
✅ Table browsing
✅ Query execution
✅ Data export
Format: Server=localhost;Database=mydb;User Id=sa;Password=secret;TrustServerCertificate=True
Examples: # Local database
Server = localhost ; Database = myapp ; User Id=sa ; Password = Pass123 ; TrustServerCertificate = True
# LocalDB
Server = ( localdb ) \M SSQLLocalDB; Database = myapp ; Integrated Security= true
# With instance name
Server = localhost \S QLEXPRESS ; Database = myapp ; User Id=sa ; Password = pass ; TrustServerCertificate = True
# Remote database
Server = db.example.com ; Database = production ; User Id=admin ; Password = secure123 ; TrustServerCertificate = True
# Windows Authentication
Server = localhost ; Database = myapp ; Integrated Security= true
Supported Features:
✅ Connection management
✅ Schema exploration (with schema support)
✅ 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
Error Meaning Solution Connection test failedDatabase is unreachable or credentials are wrong Verify connection string, check database is running Connection 'name' not foundNo connection exists with that name Use connect list to see available connections Invalid data commandIncorrect subcommand syntax Check 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