MySQL Library for TIA Portal V13 & Newer

This library allows you to connect your PLC Siemens S7-1200 or S7-1500 application to MySQL database or Maria DB.

MySQL Library for TIA Portal V13 & Newer

Demo

Free

  • Full functionality
  • S7-1200
  • S7-1500
  • Basic support
  • 2 hour runtime limitation after PLC start
Try for free

Full version

149€/PLC

  • Full functionality
  • S7-1200
  • S7-1500
  • Basic support
  • Unlimited running
Buy more and save money!

Demo

Dear Visitor,
you can download library for TIA Portal V14, V15 & V16. Library is easily importable into TIA Portal.

Disclaimer

Unfortunately not due to situation that TIA Portal doesn’t have ability to compile function blocks itself as CODESYS does. Sometimes some PLCs different firmware’s has issue with compilation of this know how protected block. If you have this issue please fill this form and we will send you library recompiled for your PLC.

Buy License

Description

This library allows you to connect your PLC Siemens S7-1200 or S7-1500 application to MySQL
database. With this library you are able to store and read process data. Read recipes from ERP, save
breakdown report and etc. No more OPC servers and other middleware.

Basic requirement for this library are TIA Portal V13 or higher and MySQL Server (V5 and higher). MySQL Database installation link is there.

Range of functions:
This library allows to the user connect to MySQL Server V5 and higher.

Supported commands:

  • SELECT
  • INSERT
  • UPDATE
  • DELETE

User guide for MySQL library for TIA Portal V13 & Newer

FAQ for MySQL Library for TIA Portal V13 & Newer

How to get SN of SIEMENS PLC.

Connect to PLC in TIA Portal choose Online&Diagnostics -> then Diagnostics and in Manufacturer information is Serial number.

SN of SIemens PLC

How to handle more SQL query in same time?

Create FIFO buffer with appropriate datatype(e.g. strings), which will work with State machine and execute commands one by one.

How to program simple code which store data after trigger?

Best approach is to create state machine such as CASE structure with states:

  1. Idle
  2. Login(set xConnect to true) after trigger
  3. Execute batch of  commands(set xExecuteSQL to true)
  4. Disconnect(set xDisconnect to true)
Timeout destination server is unreachable.

Remote server is unreachable, possible problems can be:

  • Server is turned off
  • Server is in different subnet than PLC and gateway is wrong
  • Firewall is setup wrongly. See chapter 2.1.6 in User Guide
  • Server is not configured for TCP/IP communication. See chapter 2.1.7 in User Guide or check this video.
  • sIpAddress contains Hostname such as ‘localhost’ or ‘TestSQLServer’
What happens in your program if tTimeout is exceeded?

There is more possible ways:
If you are trying:

  • Log to database tTimeout means that it failed and you get error and you have to try it again with different parameters according error message.
  • Executing QuerytTimeout means that command failed in some step and you have to try repair query due to error

Basically timeout check if the state machine is longer time in some step. So 1s is enough if you have local database. For instance if I’m connecting from Czech Republic to Amazon SQL Server in Oregon, sometimes it can exceed 1s.

What to do if PLC is broke down, and you need to replace HW?

We will provide you free of charge new activation number for new PLC.

Will library work with any PLC S7 1200/1500?

Yes, library will work with any PLC S7-1200 (from FW 4.0) and S7-1500 (from FW 1.8) programmed with TIA Portal V13, V14 & V15.
FW 3.0 on S7-1200 is old HW architecture which doesn’t support some commands used in MsSQL Library.

Can I purchase license only once and use it for more PLCs?

No, this is Single License library. So for every PLC where you will use this library, you need to have new license. License is bind to SN of PLC.

How to Activate your purchased license?

Whole process how to activate license can be found here.