ODBC

<< Click to Display Table of Contents >>

Manual > Device Connection Guide > Database > Connection Procedure >

ODBC

overview

The ODBC unit allows you to connect to a database via the Windows ODBC driver and retrieve data stored in tables via tags.

 

One tag is linked to one field. If the number of records is 1, it will be linked to the first record. If the number of records is 2 or more, it will become an array tag and will be linked in order from the first record.

 

Below is an example table.

 

FIELD01

FIELD02

FIELD03

123

456

789

 

For example, if you set it as follows, the tag value will be "123".

c_plc_0755
 

Also, if you set it as shown below, it will become an array tag and the value will be "123,456,789".

c_plc_0756

 

 

attention

When retrieving data from a database, a SELECT statement is issued internally. Therefore, depending on the type of database, the data retrieved may be in random order.

 

If you want to always retrieve data from the first record in a table, you need to create a view table in the database that sorts the records with an ORDER statement, and then connect to that view table. However, when using a view table, be aware that writing from the Server application may not be possible. Also, some databases may not allow you to reference view tables, so please check in advance whether view tables can be referenced.

 

attention

Database field names cannot start with a number.

Example) NG: 1Field OK: Field1

 

 

Settings Dialog Details

Unit communication settings

c_plc_0941

 

 

Data Source Name
Set the ODBC data source. Click the button to display the following ODBC setting dialog.

 

Table Settings
The name of the table to concatenate.

 

Schema name
If you want to specify the database schema name to connect, please specify the schema name. Note that if you are using MySQL, do not specify the schema name on this setting screen.

ODBC Settings

c_plc_0758

 

 

Data Source Name
Use the Select button to call up the data source selection screen and select the data source to connect to.

 

Login Settings
This is the setting if login is required.

 

 

Tag communication settings

c_plc_0759

 

 

Field Name
The field name to concatenate.

 

Number of records
The number of records to concatenate. If you set it to 2 or more, it becomes an array tag.