This application example shows how to connect an S7-1500 Software Controller or Open Controller to an SQL database by means of the ODK 1500S SQL driver. The drivers allows a direct and performant access to SQL databases from a STEP 7 application.
With the included function blocks it is possible to to read and write data and to edit SQL databases. All prevalent standard data types are supported. The ODK1500S SQL driver uses the ODBC interface to connect to an sql database (local or remote).
The SQL driver V3 has been tesed with the following databases:
- Microsoft SQL Server
- Oracle database
- My SQL Server
More detailed information (including supported data types) can be found in the documentation (see Downloads).
As a user interface to the database, two function blocks are available. One function block enables to execute SQL statements (e.g. Select, Insert, Update, Delete) with flexible arguments.
The second function block can be used to write data from a data block into a database without using SQL statements.
More information about this driver can be obtained from the provided PDF-documents.
|August 2015|| V 1.0|
| June 2016|| V1.1|
- Support of 64-bit floating point numbers
- Direct input of SQL statements possible (Separation between data and string not necessary)
- Generation of demo database via sql script
| July 2017|
- Implementation with ODK 1500S V2
- New user interface
- New function block for writing process data without SQL strings/statements
- New function bock for executing SQL statements without arguments
- Support of optimized data blocks
- Support for additional data types (datetime, bit…)
- SQL statements with up to 16000 characters in the user program
| August 2017|
- Support of unicode datatypes WString resp. nvarchar
- Support of variable string length in read and write direction (up to 254 characters)
- Increased data interface from 8kByte to 265 kByte (sqlArguments / sqlReceivedData)
- Improved diagnostic with SQL Viewer
| October 2018|
- new timeout parameter for FB Connect und ExecuteStatement
- compatibility mode for MS SQL "datetime" datatype
- Output of a warning as well as detail information via SQLViewer if a value with the content "NULL" is read out via a select statement
| May 2020|
- Support (read only) of blob and binary datatypes
- Test and support of further databases
| September 2020|
- Rebuild using ODK1500S 2.5.1 (bugfix)
| October 2020|
- Complete new development based on ADO.NET and ODK1500S V2.5
- Each driver FB is now multi instance capable. Thus, different SQL commands can be executed in parallel or e.g. data can be written in parallel to different databases.
- The connection information for the driver FBs is specified by the user in the PLC program via a "Connection String" parameter. A separate parameterization of the ODBC driver as well as the handling of the data base connections in the PLC program (Connect / Disconnect) by the user is therefore not necessary anymore.
- There is only one placeholder for the arguments. Instead of the different placeholders (%d, %s, %t...) for different data types the universal placeholder "" is used.
- Simplified error handling: Error messages are mostly also output as plain text on the FBs. In addition, the number of error codes has been reduced to the essential.
- ODK1500S SQL driver V3 is a 64-bit application (requires a 64-bit ODBC driver)
- Output of log information FB-granular with the help of the Windows tool “DebugView++”.
If you are interested, please contact your local sales partner:
Documentation (2,0 MB)