Advanced IVR Tutorial Lesson 2: Use Database Action
There is actually no need to write a Java program just for database access. IVR Studio provides a native database action for executing any SQL statement. To demonstrate the action, we use the same sample from this lesson but add the following: once a caller is authenticated, the application will update the database table and remember the access time.
Update the Database Table
Add a new column namedand set the column type to .
Update the Action
There is no need to update the call flow, except we need to change the Java action of theelement to a as follows:
This action provides all the functions implemented by the Java program shown in previous sections. It will load the database driver, connect to the database, execute the SQL statement, and then set the return to the action variable.
Create a new action to update the database
Select the element labeledand add the following action:
This action updates the user account and sets the Last_Login column to the current date and time.
Use SELECT statement
For database the IVR app that uses database actionsstatement, DB action returns the whole result set in a JSON array. For more info, please see the blog article