1 Introduction to the DB Connection Service
1-7
1
NJ/NX-series Database Connection CPU Units User’s Manual (W527)
1-2 DB Connection Service
Specifications and System
1-2-2 DB Connection System
1-2-2 DB Connection System
This section describes the basic and other systems of the DB Connection function.
Refer to 1-3 Operation Flow of the DB Connection Service for the operation flow.
Basic System
The following figure shows the basic system of the DB Connection function.
abc
Data 1
Data 2
Data 3
Data 4
(c) DB Connection Service
▼TABLE
Field1
Field2
Field3
Field4
Structure data type
for DB access (a)
DB Connection Instruction (e)
Basic System (The numbers show the processing order.)
1. Create a structure for NJ-series Controller that matches the column names in
the DB table. ((a) in the above figure) Section 3-2-2 will help you match the
data types between the NJ-series Controllers and database.
Refer to 3-2 Creating a
Structure Data Type.
2. Create a variable called “DB Map Variable” using the structure created in Step
1. ((b) in the above figure)
Refer to 3-3 Creating a DB
3. Start the DB Connection Service. ((c) in the above figure)
Specify the Run mode of the DB Connection Service according to the following
conditions.
When the DB is connected: Select the Operation Mode.
When the DB does not exist or not connected: Select the Test Mode.
Refer to 4-1 Run Mode of
the DB Connection Service
and Start/Stop Procedures.
4. Use a DB_Connect instruction to establish a DB Connection. This checks the
IP address or name of the server and log on credentials.
Refer to 4-2
Establishing/Closing a DB
5.Use a DB_CreateMapping instruction to connect to a table using the DB Map
Variable and apply the mapping. (called “DB mapping”). ((d) in the above
Refer to 3-4 Specifying the
Table and Apply the
6. Use DB_Insert, DB_Update, and DB_Select instructions to execute the insert,
update, and retrieve record processing. ((e) in the above figure)
When the DB Connection Service is set to the Operation Mode, the SQL
statements are sent. ((f) in the above figure)
Refer to 3-5 Programming
and Transfer.