Appendix A
When the value of the Timeout input variable is outside the valid range
When the executed SQL statement resulted in an error in the DB
When the combination of data types is not listed in the table of data type correspondence between
NJ/NX-series Controllers and database and the data type cannot be converted
When the DB Connection Service cannot communicate with the DB due to a network failure or other
causes
When the SQL statement cannot be spooled because the Spool capacity is exceeded
When one or more SQL statements are already stored in the Spool memory
When the instruction was not completed within the time specified in the TimeOut input variable
When the instruction was executed before completion of the DB's processing for the DB Connection
Instruction Execution Timeout that occurred for the previous DB_Insert, DB_Update, DB_Select, or
DB_Delete instruction
When more than 32 DB Connection Instructions were executed at the same time
Sample Programming
This section gives sample programming for the following operations.
Insert production data into a specified DB when the trigger variable changes to TRUE.
Update production data in a specified DB when the trigger variable changes to TRUE.
DB Connection Settings and Data Type Definition
The minimum settings necessary for the sample programming are shown below.
DB Connection Settings
DB Connection name: MyDatabase1
Structure Data Type Definition
Name
PRODUCTION_INSERT
Name
LotNo
Status
ProductionDate
Name
PRODUCTION_UPDATE
Status
FinishTime
Ladder Diagram
Main Variables
Name
_DBC_Status
DB_Connect_instance
MyDB1
Trigger_Connect
A-22
Data type
STRUCT
STRING[256]
STRING[32]
STRING[8]
DATE
Data type
STRUCT
STRING[8]
DATE_AND_TIME
Data type
_sDBC_STATUS
DB_Connect
DWORD
BOOL
NJ/NX-series Database Connection CPU Units User's Manual (W527)
Initial value
---
System-defined variable that shows the
status of the DB Connection Service
---
Instance of DB_Connect instruction
---
This variable is assigned to the
DBConnection output variable from
DB_Connect_instance.
FALSE
Variable used as a trigger for
establishing a DB Connection
Comment