Product Documentation

FairCom Java Stored Procedures

Previous Topic

Next Topic

Init

First we need to open a connection to a database by providing the FairCom Database Engine. Notice that, unlike the tutorials for the other APIs, the user name, password, and the database name have already been supplied. Instead, the INIT section of the tutorial simply turns on AUTOCOMMIT and drops any existing copies of the stored procedures that will be created by this tutorial.

Below is the code for Initialize():

SET ECHO OFF

-- Initialize

ECHO INIT;

SET AUTOCOMMIT ON;

IF EXISTS (select proc_name from sysprocedures where proc_name = 'define')

BEGIN

DROP PROCEDURE Define;

END

IF EXISTS (select proc_name from sysprocedures where proc_name = 'add_records')

BEGIN

DROP PROCEDURE Add_Records;

END

IF EXISTS (select proc_name from sysprocedures where proc_name = 'display_records')

BEGIN

DROP PROCEDURE Display_Records;

END

IF EXISTS (select proc_name from sysprocedures where proc_name = 'delete_records')

BEGIN

DROP PROCEDURE Delete_Records;

END

IF EXISTS (select tbl from systables where tbl = 'custmast')

BEGIN

DROP TABLE custmast;

END

TOCIndex