Function
This instruction is used to start and stop the DB Connection Service, and start and finish recording to the Debug
Log.
When the DB can be connected, start the DB Connection Service in Operation Mode.
When there is no DB, for example, in the course of development, start the DB Connection Service in Test Mode.
In this case, the following instructions are normally completed without accessing the DB and executing the SQL
statement actually.
ï‚– DB_Connect instruction,
ï‚– DB_CreateMapping instruction,
ï‚– DB_Insert instruction
ï‚– DB_Update instruction
ï‚– DB_Select instruction
ï‚– DB_Delete instruction
When the DB Connection Service is stopped, the established connections are all closed.
When recording to the debug log is started, the detailed log for each execution of DB Connection Instructions
(such as transmitted SQL statements) is output to the Debug Log file in the SD Memory Card.
Precautions for Correct Use
ï‚– Execution of this instruction is continued until processing is completed even if the value of Execute changes to
FALSE or the execution time exceeds the task period. The value of Done changes to TRUE when processing
is completed. Use this to confirm normal completion of processing.
ï‚– Refer to Using this Section of the NJ/NX-series Instructions Reference Manual (Cat. No. W502) for a timing
chart for Execute, Done, Busy, and Error.
ï‚– This instruction cannot be used on an event task. A compiling error will occur.
ï‚– When starting the DB Connection Service, confirm that the value of _DBC_Status.Idle is TRUE and then
execute this instruction. If this instruction is executed while the DB Connection Service is being initialized, an
error (DB Connection Connection Service Initializing) will occur.
ï‚– It is impossible to change the DB Connection Service from Operation Mode to Test Mode and vice versa while
the DB Connection Service is running. Stop the service before changing the Run mode.
ï‚– The recording status of the Debug Log (i.e. whether or not to record the Debug Log) is held after the DB
Connection Service is stopped and started again.
ï‚– Besides this instruction, recording to the Debug Log is stopped in the following cases.
ï‚– When a DB_Shutdown instruction is executed
ï‚– When the power supply to the CPU Unit is turned OFF
ï‚– When the SD Memory Card is taken out
ï‚– An error occurs for this instruction in the following cases. Error will be TRUE.
ï‚– When the instruction was executed while the initialization processing of the DB Connection Service
was in progress
ï‚– When the instruction was executed while the DB Connection Service was stopped due to an error
ï‚– When the instruction was executed after the DB Connection Service was shut down or while the DB
Connection Service was being shut down
ï‚– When this instruction was executed with _DBC_CMD_START_TEST selected in the Cmd input
variable while the service was running in Operation Mode
ï‚– When this instruction was executed with _DBC_CMD_START selected in the Cmd input variable
while the service was running in Test Mode