AlexMacabu
AlexMacabu

Reputation: 137

Connecting to MariaDB using Sockets

I wonder if it is possible to connect to a MariaDB server and insert data using TCP Sockets. I have a S7-1200 series PLC (industrial controller) and I am trying to connect to a MariaDB server to perform INSERT. I tried using this Function Blocks created by Siemens but apparently, they only work with Microsoft SQL (https://support.industry.siemens.com/cs/ao/en/view/109779336)

I am able to connect with the server using any Socket TCP client but I fail to login, so I believe that might be a way to use Sockets to INSERT data.

Upvotes: 0

Views: 758

Answers (2)

Per Dahlqvist
Per Dahlqvist

Reputation: 74

I think that the easy solution is to use "node-red" on your MariaDB "computer" if possible.

Connectors to the plc and the database exist, make a "flow"

Hints, free and open: Libraries for Communication for SIMATIC Controllers https://support.industry.siemens.com/cs/se/en/view/109780503 LCom: This library enables communication based on TCP/IP and provides additional communication functionalities using its own protocol. LFTP: With this library, a controller can act as an FTP client. LHTTP: This library enables data exchange with a web server in the local network or on the internet via HTTP or HTTPS. LMQTT: This library enables the communication of a controller as MQTT client. LMindConn: This library enables the direct connection of a controller to MindSphere. LOpcUa: This library provides function blocks for OPC UA PubSub communication. LSNMP: This library can be used to monitor and control SNMP-enabled network components from a controller or to send messages to a network management system. LSNTP: With this library, a controller can act as an SNTP server to synchronize the time throughout different areas of the system. LSyslog:

Library for Data Streams (LStream) https://support.industry.siemens.com/cs/se/en/view/109781165 The LStream library provides function blocks that can be used to deserialize JSON and XML data streams for the user program and to serialize them again from the user program.

//PerD

Upvotes: 1

danblack
danblack

Reputation: 14736

The TDS protocol that Siemens support is only implemented on SQL Server and not MariaDB. With a bit of engineering effort it could be implemented for MariaDB, potentially as a plugin.

Using MariaDB's CONNECT engine you may be able to do a JDBC connection to the SQL Server if you want to access the data from MariaDB.

Upvotes: 1

Related Questions