You must first copy the database DLL, CF8DATABASE.DLL, to your CopiaFacts folder. COPIAFACTS will load the DLL if it finds it at startup, even on nodes which are not configured for operations which need database access. COPIAFACTS will automatically call the DLL entry point and perform any initialization that needs to be done. The system is then ready to perform database queries.

After installing the CF8DATABASE.DLL file, you should add the keyword database to the $system_dlls configuration command. This will prevent the system from starting up if the database DLL accidentally becomes unavailable.

When you are designing an application for CopiaFacts, you need to think of each phone line as a separate user. The incoming call is comparable to a user signing on. When the call hangs up, the user is signed off. When a call hangs up, CopiaFacts resets the line. This reset also closes any database connection. Since each call possibly represents a different application or caller, it makes sense to release any database connection in effect when the call is done.

Since each call is essentially a new session, you need to repeat the same basic steps for database access. First you must identify a database and table or stored procedure that you will use. This information will be used to establish a connection and preserve information about that connection. Then you must select one or more records to retrieve from the database or execute the stored procedure. Then you may process the records, if any, that you retrieved using the selection criteria or stored procedure results. You may also retrieve values from any output parameters or the return value of a stored procedure. You perform these tasks by assigning values to system database variable names using the $set_var command.

CopiaFacts allows you to read, update, delete, or append records to a database. The database DLL reads and writes records to variables within your user variable space. Each line has its own variable space. The variables are named according to fields with the database. A table or stored procedure ID is prefixed to these field names to avoid confusion with similar field names in other record sets. This allows you to safely work with more than one table in your application.

CopiaFacts caches connection information across calls to reduce the time it takes to validate database and table information and to build the connection string. You may also use connection pooling to reduce any processing overhead in establishing database connections.