Portada » Connecting a SIMATIC S7-1500 PLC to SQL Server via TDS and TLS

Connecting a SIMATIC S7-1500 PLC to SQL Server via TDS and TLS

by admin
73 views
Communication diagram between a Siemens SIMATIC S7-1500 PLC and a SQL Server database using the Tabular Data Stream (TDS) protocol

Siemens has released version 5.0 of its application example for connecting SIMATIC S7-1500 and S7-1200 controllers directly to a Microsoft SQL Server database, with no gateways or middleware. Communication is based on the Tabular Data Stream (TDS) protocol and the Open User Communication blocks (TCON, TSEND, TRCV and TDISCON), allowing the PLC to log in to the server and run SQL queries straight from its own program.

The example includes the “LSQL_Microsoft” and “LSQL_AnalyzeTokens” blocks, now part of the LCommSuite library, along with “DeserializeRows”, a template the user adapts to convert the rows read into PLC data structures. Together they support INSERT, SELECT and UPDATE statements, as well as calling stored procedures with inputs and outputs.

The main new feature is secure TLS communication according to TDS 8.0, available since SQL Server 2022, with server certificate validation. It also adds an input for long Unicode commands (WString of up to 512 characters), login error diagnostics and an improved internal state machine. The documentation also explains step by step how to configure SQL Server Express, users, port 1433 and certificates in TIA Portal.

Related News