MsSQL Library for CODESYS V3.5 Without Store

The MsSQL library helps to read and store your data directly to Microsoft SQL Server without middleware (such as OPC).

MsSQL Library for CODESYS V3.5 Without Store

Demo

Free

  • Full functionality
  • TURCK BL20-PG-EN-V3
  • FESTO CPX-CEC
  • EATON XV300
  • Basic support
  • 2 hour runtime limitation after PLC start
Try for free

Full version

199€/PLC

  • Full functionality
  • TURCK BL20-PG-EN-V3
  • FESTO CPX-CEC
  • EATON XV300
  • Basic support
  • Unlimited running
Buy more and save money!

Buy License

Description

This library allows you to connect your CODESYS V3.5 application to Microsoft SQL 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.

Supported PLCs:

  • TURCK BL20-PG-EN-V3, TX500
  • FESTO CPX-CEC
  • EATON XV300
  • other PLC based on Codesys V3 without Store support

Basic requirement for this library is TIA Portal V13 or higher and Microsoft SQL Server (2005 or
higher). Microsoft SQL Server 2014 Express is there.

Range of functions:
This library allows to the user connect to Microsoft SQL Server from 2005 to 2017. This library use for
communication with server TDS protocol.

Supported commands:

  • SELECT
  • INSERT
  • UPDATE
  • DELETE

User guide for MsSQL library for CODESYS V3.5 Without Store

FAQ for MsSQL Library for CODESYS V3.5 Without Store

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’
How to check if my PLC supports Codesys Store
  1. Install to your codesys enviroment package Device Reader.
  2. Load it to your CPU.
  3. Check what functionalities are available. If single device license is green. Then you can use library from Codesys store. If not, then you have to use product MsSQL Library without Store.

How to get MAC Address of your Codesys PLC

Load into your PLC with Codesys Runtime Example project with fbMsSQL library. Load it to your CPU and run project. On output of this block you will find variable sMacAddress with MAC Address which is used for licensing.

How to insert datatype text (e.g. nvarchar(255) to MsSQL Database?

Note! Dollar sign($) is needed if you are using ‘ in string and if you want to store string into database   N$’Your_string$’.

INSERT INTO [dbo].[Table_TEST] ([text]) VALUES (N$’Hello World 🙂$’)

How to insert datatype DateTime to MsSQL Database?

Example of command to how to insert datetime to MsSQL database:
EXEC sp_insertData @TIMESTAMP = N$’2016-11-12 19:45:33$’, @Value= 12

Explanation:
EXEC sp_insertData – execution stored procedure sp_insertData which is declared on MsSQL Server. Note! If you will create stored procedure on MsSQL Server side, don’t forget to setup execute permission to user which is used on PLC.
@TIMESTAMP= N$’2016-11-12 19:45:33$’ – inserting datatime to database as a string value, but in PLC string has to be used dollar sigh($) before ‘.
@Value = 12 – is just normal integer value

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)
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.

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.

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.