Product Documentation

FairCom Java & .NET Stored Procedures

Previous Topic

Next Topic

Java Quick Tour

This QuickStart is composed of four simple tutorials designed to guide you through the basic use of the FairCom DB SQL Stored Procedures technology.

Tutorials for Java Stored Procedures can be found in the ReadMe titled FairCom Java Stored Procedures.

As with all other tutorials in the c-tree series, each of these database programming tutorials is implemented with four simple code procedures: Initialize(), Define(), Manage(), and Done().

No matter which FairCom interface language you use, FairCom follows this same high-level flow in all tutorials. This makes it easy for developers to "cross-over" from one language interface to another as these basic concepts apply to all.

Initialize()

Every language requires some form of initial "logon" or "connection" procedure to establish a session with the database. This is done in the Initialize() stage of the program.

Define()

Database definitions (DDL), Table/File schema definitions, Index definitions, Table/File creation, and Table/File open operations are all addressed in the Define() stage of the program.

Manage()

This stage of the program is where the database is operated on, as in managing your data. Adding/Reading/Updating/Deleting records/rows are handled in this stage of the program.

Done()

When the program ends, the database session should be closed. This stage handles the necessities to "de-init", by closing Tables/Files and issuing any required "logoff" or "disconnect" type procedures.

Presented here are tutorials that follow the "Initialize(), Define(), Manage(), and Done()" approach.

You can also view similar tutorials for all supported languages online.

Four SQL scripts have been included in the SQL Stored Procedures Tutorial directory, located in:


C:\<faircom>\win32\sdk\sql.stored.procs\tutorials (where C:\<faircom> is your installation directory. The default installation directory was C:\<faircom>).

The following is a conceptual overview of these tutorials:

Tutorial #1: Introductory - Simple Single Table

We wanted to keep this program as simple as possible. This program does the following:

  • Initialize() - Connects to the FairCom DB database engine.
  • Define() - Defines and creates a "customer master" (custmast) file/table.
  • Manage() - Adds a few records/rows; Reads the records/rows back from the database and displays their content; and then deletes the records/rows.
  • Done() - Disconnects from FairCom DB Database Engine.

Tutorial #2: Relational Model and Indexing

Here we now add a bit more complexity, introducing multiple tables, with related indices in order to form a simple "relational" database simulating an Order Entry system. Here is an overview of what will be created:

JDBC Relational Picture

  • Initialize() - Connects to the FairCom DB database engine.
  • Define() - Defines and creates the "custmast", "custordr", "ordritem" and the "itemmast" files/tables with related indices.
  • Manage() - Adds some related records/rows to all files/tables. Then queries this order database.
  • Done() - Disconnects from FairCom DB Database Engine.

Tutorial #3: Locking

Here we demonstrate the enforcement of data integrity by introducing record/row "locking".

  • Initialize() - Connects to the FairCom DB database engine.
  • Define() - Defines and creates a "customer master" (custmast) file/table.
  • Manage() - Adds a few records/rows; Reads the records/rows back from the database and displays their content. Then demonstrates an update operation under locking control, and a scenario that shows a locking conflict.
  • Done() - Disconnects from FairCom DB database engine.

Tutorial #4: Transaction Processing

Here we demonstrate transaction control.

  • Initialize() - Connects to the FairCom DB database engine.
  • Define() - Defines and creates our four file/tables.
  • Manage() - Adds records/rows to multiple tables under transaction control.
  • Done() - Disconnects from FairCom DB Database Engine.

Learn More...

Try the tutorials in in the ReadMe titled FairCom Java Stored Procedures.

TOCIndex