TwinCAT Database Server Project

Build Project

The TwinCAT Connectivity extension for Visual Studio provides a new project template. When a new project is created, the TwinCAT Connectivity Project category appears as an option.

To create a new TwinCAT Connectivity project, select Empty TwinCAT Connectivity Project, specify the project name and the storage location and click OK to add it to the solution. In this way, TwinCAT Connectivity projects or TwinCAT Database Server projects can conveniently be created in parallel with TwinCAT or other Visual Studio projects.

TwinCAT Database Server Project 1:

A new project node appears in the solution. Below the Connectivity project node you can add subprojects for the supported connectivity functions.

Use Add to add a new TwinCAT Database Server project to the TwinCAT Connectivity project. The TwinCAT Database Server project can be found in the list of existing Item Templates.

TwinCAT Database Server Project 2:

A new TwinCAT Database Server project is created under the TwinCAT Connectivity node.

TwinCAT Database Server Project 3:

This is now used as the basis for the pending configuration of a TwinCAT Database Server. The document can be edited either via the Properties window or via an editor.

A Connectivity project can be associated with any number of TwinCAT Database Server projects or other projects, and it may therefore contain several configurations.

Editor for server settings

TwinCAT Database Server Project 4:

The Server Settings editor can be used to edit the settings for the TwinCAT Database Server. These are general settings relating to the corresponding server. In the drop-down menu (1) you can select the target system via the Ams NetID. To this end you have to create a route to the target system via TwinCAT. When a finished configuration is transferred, the settings are stored in the TwinCAT Database Server for this target system.

The settings for logging faults or errors can be configured under Log settings. In the event of a fault or error, the Database Server generates a detailed entry in a log file. The log file can be read with the Information Log Viewer. Under Log Settings you can specify a path to the file location and the maximum file size. You can also influence the accuracy of the log. For performance reasons we recommend that logging is deactivated again after the error analysis, once it is no longer required.

For network access to file-based databases such as Access or SQL Compact, the Impersonate option must be set, so that the TwinCAT Database Server can connect to this network drive. This feature is currently not supported in Windows CE.

Further configuration settings are available to control the read process from the database. These settings refer to the TwinCAT Database Server on the target system:

MaxStringLength

Maximum string length of the variables in the PLC

MaxByteArrayLength

Maximum byte array length of the variables in the PLC

DBNullAllowed

Indicates whether ZERO values are accepted in the TwinCAT Database Server.

DBConnectionTimeout

Indicates the time after which the TwinCAT Database Server assumes a connection error while attempts are made to establish a connection.

DBCommandTimeout

Indicates the time after which the TwinCAT Database Server assumes a connection fault when a command was sent. If large data quantities are involved, processing of a command may take quite some time, depending on the database and the infrastructure.

Supported database types

TwinCAT Database Server Project 5:

The installed database types can be selected in the server settings. All installed databases are selected by default. The TwinCAT 3 Database Server will load the corresponding database interfaces. In this way, unused databases on the target system can be deselected.

Server settings in the Properties window

The settings for the TwinCAT Database Server can be adjusted in the Editor window or in the Properties window of the Database Server. These properties also directly affect the configuration file.

TwinCAT Database Server Project 6:

Activating a project

To activate a configured project on the TwinCAT Database Server, use the command Activate Configuration in the context menu of the TwinCAT Database Server project.

TwinCAT Database Server Project 7: