Documentation

FairCom Java & .NET Stored Procedures

Next Topic

FairCom Java and .NET Stored Procedures, Triggers, and User Defined Functions

Developer Guide

FairCom Java & .NET Stored Procedures

Audience:

Developers

Subject:

How to use .NET and Java to develop stored procedures, triggers, and user-defined functions that run inside the FairCom DB

Copyright:

© Copyright 2021, FairCom Corporation. All rights reserved. For full information, see the FairCom Copyright Notice.

 

About the Documentation

FairCom supports stored procedures, user-defined functions, and triggers written in either of two different development environments: cross-platform Java and .NET languages such as in C#. This book contains information about both environments:

In addition, you will find tutorials for these languages in the ReadMe's:

In This Chapter

Overview of Stored Procedures

Advantages of Stored Procedures

Next Topic

Overview of Stored Procedures

Stored procedures and triggers provide the ability to write Java and .NET routines that contain SQL statements and store those routines within a FairCom DB SQL database. Tools and applications can then execute the procedures.

A stored procedure is a snippet of code embedded in an SQL CREATE PROCEDURE statement. The snippet can use all standard Java or .NET features as well as FairCom DB SQL supplied Java classes for processing any number of SQL statements.

A trigger is a special type of stored procedure that helps ensure referential integrity for a database. Like stored procedures, triggers also contain Java or .NET code (embedded in a CREATE TRIGGER statement) and classes. However, triggers are automatically invoked (“fired”) by certain SQL operations (an insert, update, or delete operation) on the trigger’s target table.

User defined functions (UDFs) extend the availability of built-in scalar functions with modules written by the user. The user can transform data with custom routines for their unique business needs. These procedures are created with the FairCom DB SQL CREATE FUNCTION statement.

Next Topic

Advantages of Stored Procedures

Stored procedures and triggers provide a flexible, general mechanism to store a collection of SQL statements and program constructs in a database enforcing business rules and performing administrative tasks.

The ability to write stored procedures and triggers expands the flexibility and performance of applications that access a FairCom DB SQL environment:

  • In a client/server environment, applications make only a single client/server request for the entire procedure, instead of one or more requests for each FairCom DB SQL statement in the stored procedure or trigger.
  • Stored procedures and triggers are stored in compiled form (as well as source-code form), so they execute much faster than a corresponding FairCom DB SQL script.
  • Stored procedures can implement elaborate algorithms to enforce complex business rules. The details of the procedure implementation can change without requiring changes in an application that calls the procedure.

TOCIndex