Docs/Data Sources/SQL Server
DATA SOURCE5 min read

SQL Server

Connecting Microsoft SQL Server databases to Conexor

Prerequisites

  • SQL Server 2016 or later (including Azure SQL Database)
  • Network access from the agent machine to SQL Server
  • A SQL login with SELECT permissions on required tables

Connection String Format

text
Server=hostname,1433;Database=YourDatabase;User Id=conexor_user;Password=your_password;TrustServerCertificate=True;
INFOUse TrustServerCertificate=True for development. In production, use proper SSL certificates.

Azure SQL Database

text
Server=tcp:your-server.database.windows.net,1433;Database=YourDatabase;User ID=conexor_user@your-server;Password=your_password;Encrypt=True;Connection Timeout=30;

Schema Discovery

Conexor automatically discovers:

  • All tables and views (from INFORMATION_SCHEMA)
  • Column names, types, and nullability
  • Primary and foreign key relationships
  • Approximate row counts (using sys.partitions)

Query Syntax

Use standard T-SQL with named parameters prefixed with @:

sql
SELECT TOP 100 
    OrderId, CustomerName, OrderDate, Total
FROM Orders 
WHERE CustomerId = @customerId
    AND OrderDate >= @startDate
ORDER BY OrderDate DESC

Required Permissions

sql
-- Create a dedicated login for Conexor
CREATE LOGIN conexor_user WITH PASSWORD = 'strong_password';

-- Grant access to the database
USE YourDatabase;
CREATE USER conexor_user FOR LOGIN conexor_user;

-- Grant SELECT on schemas
GRANT SELECT ON SCHEMA::dbo TO conexor_user;

-- Or grant on specific tables only
GRANT SELECT ON dbo.Orders TO conexor_user;
GRANT SELECT ON dbo.Customers TO conexor_user;
NOTENever grant INSERT, UPDATE, DELETE, or DDL permissions. Conexor only needs SELECT.

Troubleshooting

Connection timeout

Check firewall rules allow inbound connections on port 1433. Verify SQL Server is configured for TCP/IP connections.

SSL certificate error

Add TrustServerCertificate=True to your connection string, or install the proper certificate.

Login failed

Verify SQL Server authentication mode is set to "SQL Server and Windows Authentication".

Relay

Quick questions

Relay

Quick questions