Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Connect Microsoft SQL Server

Connect Horizon Epoch to Microsoft SQL Server databases.

CLI Configuration

# Add SQL Server storage backend
epoch storage add mydb \
    --type mssql \
    --url "mssql://user:pass@localhost:1433/database"

Connection String Format

mssql://[user[:password]@][host][:port]/database[?param=value&...]

Common parameters:

  • encrypt - off, on, required
  • trust_server_certificate - true/false
  • application_name - Application name for logging

Encryption Modes

ModeDescription
offNo encryption
onEncrypt if server supports it
requiredRequire encryption (recommended)

With Encryption

epoch storage add mydb \
    --type mssql \
    --url "mssql://user:pass@host/db?encrypt=required"

Trust Self-Signed Certificate

epoch storage add mydb \
    --type mssql \
    --url "mssql://user:pass@host/db?encrypt=required&trust_server_certificate=true"

Authentication Methods

SQL Server Authentication

epoch storage add mydb \
    --type mssql \
    --url "mssql://sa:password@localhost/database"

Windows Authentication

epoch storage add mydb \
    --type mssql \
    --url "mssql://localhost/database?integrated_security=true"

Register Tables

epoch table add customers \
    --location "mssql://mydb/dbo.customers"

Azure SQL Database

epoch storage add azure \
    --type mssql \
    --url "mssql://user@server:pass@server.database.windows.net:1433/database?encrypt=required"

Troubleshooting

Connection Refused

  • Verify SQL Server is running and TCP/IP is enabled
  • Check SQL Server Configuration Manager for network settings
  • Verify firewall allows port 1433

Login Failed

  • Verify SQL Server authentication is enabled (mixed mode)
  • Check username and password
  • Verify user has access to the database

Encryption Errors

  • Ensure encrypt setting matches server configuration
  • For self-signed certs, use trust_server_certificate=true