1. A controller comprising: a communication interface configured to be connected to a database system; an instruction executing unit configured to execute a user program for controlling a control object; and an access processing unit, at the time of executing the user program including an access instruction to access the database system by the instruction executing unit, configured to control an access to the database system via the communication interface by a statement according to the access instruction, wherein the access processing unit operates in a first mode and a second mode, in the first mode, transmits a statement according to the access instruction to the database system and sends a result of response of the statement to the user program, and in the second mode, sends an execution result corresponding to the statement to the user program without transmitting the statement to the database system.