Connecting to HeliosDB
Connecting to HeliosDB
This guide covers all the ways to connect to HeliosDB using different protocols, programming languages, and tools.
Table of Contents
- Connection Protocols
- Command-Line Clients
- Programming Languages
- GUI Tools
- Connection Pooling
- Security & Authentication
- Troubleshooting
Connection Protocols
HeliosDB supports multiple wire protocols for maximum compatibility:
| Protocol | Port | Use Case | Compatibility |
|---|---|---|---|
| PostgreSQL | 5432 | Default, broad tool support | psql, pgAdmin, Postico, etc. |
| MySQL | 3306 | MySQL client compatibility | mysql CLI, MySQL Workbench |
| gRPC | 50051 | High-performance, low-latency | Custom clients, microservices |
| HTTP/REST | 8080 | Web apps, serverless | curl, Postman, browsers |
| WebSocket | 8081 | Real-time streaming | JavaScript clients, dashboards |
Command-Line Clients
1. HeliosDB Native CLI (Recommended)
Best autocomplete, syntax highlighting, and HeliosDB-specific features
# Installcargo install heliosdb-cli
# Connectheliosdb cli connect \ --host localhost \ --port 5432 \ --username helios \ --database myapp
# With password from environmentexport HELIOSDB_PASSWORD=mysecretpasswordheliosdb cli connect --host localhost --username helios
# Connection string formatheliosdb cli connect postgresql://helios:password@localhost:5432/myappFeatures:
- Tab completion for SQL keywords, table names, column names
- Syntax highlighting
- Query history (↑/↓ arrows)
- Multi-line editing
- JSON formatting
- Performance metrics display
Example session:
heliosdb> \c myappConnected to database "myapp"
heliosdb> SELECT * FROM users WHERE id = 1; id | username | email | created_at----+----------+--------------------+------------------------- 1 | alice | alice@example.com | 2025-11-01 10:30:00
Query time: 2.3msRows returned: 1
heliosdb> \dt List of relations Schema | Name | Type | Owner--------+--------+--------+------- public | users | table | helios public | posts | table | helios2. psql (PostgreSQL Client)
Most widely used, excellent compatibility
# Install (if not already installed)# Ubuntu/Debiansudo apt install postgresql-client
# macOSbrew install libpq
# Connectpsql -h localhost -p 5432 -U helios -d myapp
# With password inline (not recommended for production)PGPASSWORD=mysecretpassword psql -h localhost -U helios -d myapp
# Connection stringpsql postgresql://helios:password@localhost:5432/myapp
# With SSL/TLSpsql "postgresql://helios@localhost:5432/myapp?sslmode=require"Useful psql commands:
\l -- List databases\c myapp -- Connect to database\dt -- List tables\d users -- Describe table\di -- List indexes\df -- List functions\dv -- List views\du -- List users\q -- Quit
\timing on -- Show query execution time\x on -- Expanded display (vertical format)\o output.txt -- Write output to file3. mysql CLI
For users familiar with MySQL
# Installsudo apt install mysql-client
# Connectmysql -h localhost -P 3306 -u helios -p myapp
# Connection parametersmysql \ --host=localhost \ --port=3306 \ --user=helios \ --password=mysecretpassword \ --database=myappNote: HeliosDB’s MySQL protocol emulation supports most MySQL features, but some advanced MySQL-specific functions may behave differently.
Programming Languages
Python
Install Client
HeliosDB Full speaks the PostgreSQL wire protocol, so use a standard PostgreSQL driver such as psycopg:
pip install "psycopg[binary]"
# Or the older psycopg2 driverpip install psycopg2-binarySynchronous Connection (psycopg 3)
import psycopg
with psycopg.connect( host="localhost", port=5432, user="helios", password="mysecretpassword", dbname="myapp",) as conn: rows = conn.execute("SELECT * FROM users WHERE id = %s", (1,)).fetchall() for row in rows: print(row)# Connection closed (and the transaction committed) on exitAsync Connection (psycopg 3)
import asyncioimport psycopg
async def main(): async with await psycopg.AsyncConnection.connect( "postgresql://helios:mysecretpassword@localhost:5432/myapp" ) as conn: cur = await conn.execute("SELECT * FROM users LIMIT 10") async for row in cur: print(row)
asyncio.run(main())Using psycopg2 (PostgreSQL Driver)
import psycopg2
# Connectconn = psycopg2.connect( host="localhost", port=5432, user="helios", password="mysecretpassword", database="myapp")
# Create cursorcur = conn.cursor()
# Execute querycur.execute("SELECT * FROM users WHERE email = %s", ("alice@example.com",))
# Fetch resultsrows = cur.fetchall()for row in rows: print(row)
# Commit transactionconn.commit()
# Closecur.close()conn.close()JavaScript/TypeScript
Install Client
HeliosDB Full speaks the PostgreSQL wire protocol, so use the standard
node-postgres driver. (There is no HeliosDB
package on npm — the unrelated heliosdb npm package is not ours.)
npm install pg
# Or with TypeScript typesnpm install pg @types/pgNode.js Connection
const { Client } = require('pg');
// Create clientconst client = new Client({ host: 'localhost', port: 5432, user: 'helios', password: 'mysecretpassword', database: 'myapp'});
// Connectawait client.connect();
// Execute queryconst result = await client.query('SELECT * FROM users WHERE id = $1', [1]);
console.log(result.rows);
// Closeawait client.end();TypeScript with Type Safety
import { Client, QueryResult } from 'pg';
interface User { id: number; username: string; email: string; created_at: Date;}
const client = new Client({ host: 'localhost', port: 5432, user: 'helios', password: 'mysecretpassword', database: 'myapp'});
await client.connect();
const result: QueryResult<User> = await client.query<User>( 'SELECT * FROM users WHERE id = $1', [1]);
result.rows.forEach((user: User) => { console.log(`${user.username}: ${user.email}`);});
await client.end();Connection Pooling with node-postgres
const { Pool } = require('pg');
const pool = new Pool({ host: 'localhost', port: 5432, user: 'helios', password: 'mysecretpassword', database: 'myapp', max: 20, // Connection pool size idleTimeoutMillis: 30000});
// Execute queryconst result = await pool.query('SELECT * FROM users WHERE email = $1', ['alice@example.com']);
console.log(result.rows);Java
Add Maven Dependency
Use the standard PostgreSQL JDBC driver (HeliosDB Full speaks the PostgreSQL wire protocol):
<dependency> <groupId>org.postgresql</groupId> <artifactId>postgresql</artifactId> <version>42.6.0</version></dependency>JDBC Connection
import java.sql.*;
public class HeliosDBExample { public static void main(String[] args) { String url = "jdbc:postgresql://localhost:5432/myapp"; String user = "helios"; String password = "mysecretpassword";
try (Connection conn = DriverManager.getConnection(url, user, password)) { System.out.println("Connected to HeliosDB!");
// Execute query String sql = "SELECT * FROM users WHERE id = ?"; PreparedStatement pstmt = conn.prepareStatement(sql); pstmt.setInt(1, 1);
ResultSet rs = pstmt.executeQuery();
while (rs.next()) { System.out.println("User: " + rs.getString("username")); System.out.println("Email: " + rs.getString("email")); }
rs.close(); pstmt.close();
} catch (SQLException e) { System.err.println("Connection failed: " + e.getMessage()); } }}Spring Boot Configuration
spring: datasource: url: jdbc:postgresql://localhost:5432/myapp username: helios password: mysecretpassword driver-class-name: org.postgresql.Driver hikari: maximum-pool-size: 20 minimum-idle: 5 connection-timeout: 30000Go
HeliosDB Full speaks the PostgreSQL wire protocol, so any standard Go PostgreSQL driver works. The example below uses pgx. For the HeliosDB REST API there is also a Go client: go get github.com/HeliosDatabase/HeliosDB-SDKs/sdks/go@v0.1.0 (source: HeliosDB-SDKs/sdks/go).
Install Module
go get github.com/jackc/pgx/v5Connection Example
package main
import ( "context" "fmt" "log"
"github.com/jackc/pgx/v5")
func main() { ctx := context.Background() conn, err := pgx.Connect(ctx, "postgres://helios:mysecretpassword@localhost:5432/myapp") if err != nil { log.Fatal(err) } defer conn.Close(ctx)
rows, err := conn.Query(ctx, "SELECT id, username, email FROM users WHERE id = $1", 1) if err != nil { log.Fatal(err) } defer rows.Close()
for rows.Next() { var id int var username, email string if err := rows.Scan(&id, &username, &email); err != nil { log.Fatal(err) } fmt.Printf("User: %s (%s)\n", username, email) }}Rust
Add Dependency
[dependencies]heliosdb = "0.6.0"tokio = { version = "1.35", features = ["full"] }Connection Example
use heliosdb::{Client, Error};
#[tokio::main]async fn main() -> Result<(), Error> { // Create client let client = Client::builder() .host("localhost") .port(5432) .user("helios") .password("mysecretpassword") .database("myapp") .build() .await?;
// Execute query let rows = client .query("SELECT * FROM users WHERE id = $1", &[&1]) .await?;
// Process results for row in rows { let username: String = row.get("username"); let email: String = row.get("email"); println!("User: {} ({})", username, email); }
Ok(())}GUI Tools
1. HeliosDB Studio (Official GUI)
Native desktop application for HeliosDB
HeliosDB Studio is provided to licensed HeliosDB Full customers — contact sales@heliosdb.com.
Features:
- Visual query builder
- Schema designer
- Performance monitoring
- Query profiling
- Data export/import
2. pgAdmin (PostgreSQL Admin Tool)
Works with HeliosDB via PostgreSQL protocol
- Download from https://www.pgadmin.org/
- Add new server:
- Host: localhost
- Port: 5432
- Username: helios
- Password: (your password)
3. DBeaver (Universal Database Tool)
Cross-platform, supports multiple databases
- Download from https://dbeaver.io/
- Create new connection → PostgreSQL
- Enter connection details
4. DataGrip (JetBrains IDE)
Professional database IDE
- File → New → Data Source → PostgreSQL
- Configure connection
- Test connection
Connection Pooling
Why Use Connection Pooling?
- Reduce connection overhead: Reuse existing connections
- Better concurrency: Handle more simultaneous requests
- Resource management: Limit total connections
Python Connection Pooling
from heliosdb.pool import ConnectionPool
# Create poolpool = ConnectionPool( dsn="postgresql://helios:password@localhost/myapp", min_size=10, # Minimum connections max_size=100, # Maximum connections timeout=30.0 # Connection timeout (seconds))
# Acquire connection from poolasync with pool.acquire() as conn: result = await conn.execute("SELECT * FROM users") print(result.rows)
# Connection automatically returned to poolNode.js Connection Pooling
const { Pool } = require('pg');
const pool = new Pool({ host: 'localhost', port: 5432, user: 'helios', password: 'mysecretpassword', database: 'myapp', max: 20, // Max connections min: 5, // Min connections idleTimeoutMillis: 30000, // Close idle connections after 30s connectionTimeoutMillis: 2000});
// Use poolpool.query('SELECT * FROM users', (err, res) => { if (err) throw err; console.log(res.rows);});Java Connection Pooling (HikariCP)
import com.zaxxer.hikari.HikariConfig;import com.zaxxer.hikari.HikariDataSource;
public class DatabasePool { private static HikariDataSource dataSource;
static { HikariConfig config = new HikariConfig(); config.setJdbcUrl("jdbc:postgresql://localhost:5432/myapp"); config.setUsername("helios"); config.setPassword("mysecretpassword"); config.setMaximumPoolSize(20); config.setMinimumIdle(5); config.setConnectionTimeout(30000);
dataSource = new HikariDataSource(config); }
public static Connection getConnection() throws SQLException { return dataSource.getConnection(); }}Security & Authentication
Password Authentication
Basic username/password (default):
# Set password in environmentexport HELIOSDB_PASSWORD=mysecretpassword
# Connect without entering passwordpsql -h localhost -U helios -d myappSSL/TLS Encryption
Encrypt connections in transit:
# Require SSLpsql "postgresql://helios@localhost/myapp?sslmode=require"
# Verify server certificatepsql "postgresql://helios@localhost/myapp?sslmode=verify-full&sslrootcert=/path/to/ca.crt"Python with SSL:
client = HeliosClient( host="localhost", port=5432, user="helios", password="password", database="myapp", sslmode="require", sslrootcert="/path/to/ca.crt")Certificate Authentication (mTLS)
Use client certificates instead of passwords:
psql "postgresql://helios@localhost/myapp?sslmode=require&sslcert=/path/to/client.crt&sslkey=/path/to/client.key&sslrootcert=/path/to/ca.crt"LDAP/Active Directory
Enterprise authentication:
Configure in heliosdb.conf:
[auth]method = "ldap"ldap_server = "ldap://ldap.example.com"ldap_base_dn = "ou=users,dc=example,dc=com"ldap_bind_dn = "cn=admin,dc=example,dc=com"ldap_bind_password = "admin_password"OAuth2/OIDC
Use existing identity providers:
from heliosdb import HeliosClient
client = HeliosClient.from_oauth( host="localhost", port=5432, oauth_provider="https://accounts.google.com", oauth_client_id="your-client-id", oauth_client_secret="your-secret")Troubleshooting
Connection Refused
Error: could not connect to server: Connection refused
Solutions:
# 1. Check if server is runningsudo systemctl status heliosdbps aux | grep heliosdb
# 2. Check if port is listeningsudo netstat -tlnp | grep 5432
# 3. Check firewall rulessudo ufw statussudo ufw allow 5432/tcp
# 4. Check listen_addresses in heliosdb.conf# Should be: listen_addresses = '*'Authentication Failed
Error: password authentication failed for user "helios"
Solutions:
# 1. Reset passwordheliosdb user set-password --username=helios --password=newpassword
# 2. Check pg_hba.conf# Should have: host all all 0.0.0.0/0 md5
# 3. Verify usernamepsql -h localhost -U helios -d myappTimeout Errors
Error: connection timeout
Solutions:
# Increase timeoutclient = HeliosClient( host="localhost", connect_timeout=60 # Increase to 60 seconds)SSL Certificate Errors
Error: SSL error: certificate verify failed
Solutions:
# Option 1: Disable SSL verification (dev only!)psql "postgresql://helios@localhost/myapp?sslmode=disable"
# Option 2: Trust self-signed certificatepsql "postgresql://helios@localhost/myapp?sslmode=require"
# Option 3: Verify with CA certificatepsql "postgresql://helios@localhost/myapp?sslmode=verify-full&sslrootcert=/path/to/ca.crt"Connection String Format
PostgreSQL DSN Format
postgresql://[user[:password]@][host][:port][/dbname][?param1=value1&...]Examples:
# Basicpostgresql://helios@localhost/myapp
# With passwordpostgresql://helios:password@localhost:5432/myapp
# With SSLpostgresql://helios@localhost/myapp?sslmode=require
# With multiple parameterspostgresql://helios@localhost/myapp?sslmode=require&connect_timeout=30&application_name=myappNext: Querying Data →