SQL Server Overview
TheSQLSERVER route stores MQTT messages in Microsoft SQL Server databases. It supports Windows and SQL authentication, SSL connections, and enterprise features.
SQL Server is ideal for enterprise environments, especially those integrated with Microsoft ecosystems. It offers advanced features like Always On availability and native JSON support.
Basic Syntax
Connection Configuration
SQL_CONFIG Parameters
SQL Server hostname or IP address. Can include instance name (e.g.,
server\instance).Target database name.
SQL Server username.
SQL Server password.
Writing Data
- Basic Storage
- With SSL
- Named Instance
- UPSERT
- UPDATE
- DELETE
Store sensor data in SQL Server:
Alternative: STORE IN with Models — Instead of writing EVENT queries, you can bind a model directly to this route. Every See Data Storage Overview for the full STORE IN workflow.
PUBLISH MODEL call automatically inserts a row — no query needed:Reading Data
EVENTs also support SELECT queries to read data back from the database. Publish a message to the event’sSOURCE_TOPIC, and the query result is published to DESTINATION_TOPIC:
db/result/latest, where your actions or external clients can consume it.
Timed Polling
EVENTs can also run SELECT queries on a fixed schedule usingWITH EVERY:
Table Schema Examples
Troubleshooting
Connection Refused
Connection Refused
- Verify SERVER and PORT are correct
- Check SQL Server is running and accepting TCP connections
- Enable TCP/IP in SQL Server Configuration Manager
- Verify firewall allows connections on port 1433
Authentication Failed
Authentication Failed
- Verify USERNAME and PASSWORD are correct
- Ensure SQL Server authentication is enabled (mixed mode)
- Check user has permissions on the DATABASE
SSL/Certificate Errors
SSL/Certificate Errors
- Set TRUST_SERVER_CERTIFICATE “true” for self-signed certs
- Verify SSL is configured on SQL Server
Next Steps
Data Storage Routes Overview
Compare all storage options.
MongoDB Route
Configure MongoDB document storage.

