Feedback

  • Contents
 

Database Tools

The Database tools allow handlers and subroutines to read from and update databases. In the default handlers that ship with CIC, many of the reporting and statistic gathering handlers use database tools, and the CustomCallDisconnectMonitor handler writes call recording information to a database for use by the Interaction Recorder application. Database tools have many uses because they allow you to read from and write to a database outside of the CIC server. While their uses are virtually unlimited, some other uses are looking up passwords and retrieving information to display in web pages.

Typically, the Database tools are used in the following order within a handler, as illustrated by this diagram, entitled The order in which Database tools should be used. Use this multi-step process as guide when creating database functionality within a handler.

Note: In rare circumstances where you have a very large number of tables to load and/or your server is fairly busy at the time you need to load the tables, it is possible that the system might timeout before the tables have finished loading. If this happens, the timeout period can be reset to whatever you desire by entering the following command in a DOS window:

/DBQueryTimeout=X

Where X is an integer representing the number of seconds to wait before timing out.

Step One: DB Open to open an ODBC data source

With DB Open you specify the data source, username, password, name of the variable to hold the connection handle, and the maximum number of connections. Most other Database tools use this connection.

Step Two: DB Get Connection to a connection with the database

DB Get Connection attempts to open the actual connection. Once the connection is established, DB Query, DB Fetch, and DB SQL Exec can perform operations on the database.

Step Three: DB Query can find records. DB SQL Exec can perform operations on the database.

With a connection established, DB Query can execute a Where clause to create a result set, preparing the records for a DB Fetch step. Each connection can only store one result set, so if you need to retrieve multiple result sets for multiple fetches, you should use additional DB Get Connection steps. DB SQL Exec can insert, update, or delete records, or run a script stored on the database server.

Step Four: DB Fetch accesses the result set.

DB Fetch retrieves a record(s) from the result set. The values retrieved are stored in the variables set up in the DB Query step.

Step Five: DB Release Connection

If the handler no longer needs to access the database, use a DB Release Connection to drop the connection to the database. If you opened multiple connections, you can use this step to close any connections that you do not need.

Step Six: DB Close

When the handler finishes running, you should close the ODBC data source with a DB Close step.

 

Database tools:

DB Close

DB Fetch

DB Flush

DB Get Connection

DB Get Data List

DB Open

DB Put Data List

DB Query

DB Release Connection

DB SQL Exec

DB SQL Exec2

DB Stored Procedure

 

Related Topics:

Supported Databases