This tutorial provides four batch files that demonstrate interaction with the FairCom database server using SQL statements. Go directly to the <faircom>\drivers\sql.cli\tutorials directory that is installed with the product to examine the code and try your hand at it, or proceed with the following instructions.
Submit SQL statements to a FairCom server:
- Install and start up the FairCom server if it is not currently running.
- Optionally read the Introduction to ISQL.
-
Run SQL statements in any of the following ways:
- Use the CLI for - Windows
- Use the CLI for - Linux
- Use the FairCom Data Explorer GUI
When running the tutorials, tutorial #4 will throw four “Constraint violation” errors.
…error(-20116): Constraint violation NOTE: constraint violation expectedThis is expected and indicates correct behavior.
If you get the following error:
error in tcp bind 111 error(-20212): Error in Network DaemonThe most common cause of this error is that the FairCom Database Engine is not running on your machine. Remember that the evaluation license times out after 3 hours, so the server might have exited and needs to be restarted.
Introduction to ISQL
FairCom interactive SQL (ISQL) is a command processing interface to the FairCom database server. You can use ISQL to test and prototype SQL statements to be embedded in programs to modify an existing database, perform ad-hoc queries, and run existing SQL scripts. With few exceptions, you can send any SQL statement to ISQL, including CREATE, SELECT, and GRANT statements.
FairCom provides two separate ways to implement ISQL: A command-line interface (CLI) for Windows and Linux, and a graphical user interface (GUI). Both implementations allow you to issue SQL statements individually or run a batch file (or make for LInux) with multiple SQL statements for immediately displayed results.
CLI for Windows
FairCom provides a batch file that launches four interactive SQL tutorials in sequence with a pause between each tutorial. This can be executed from the command line as follows:
Open a Windows command prompt.
- Change to the
<faircom>\drivers\sql.cli\tutorials\cmdline\folder. - Run the
BuildTutorials.batfile.
The four tutorials can also be run separately and individually from the command prompt as follows:
- Change to the
<faircom>\drivers\sql.cli\tutorials\folder. - Execute each tutorial as follows:
..\..\..\tools\isql -s iSQL_Tutorial1.sql -u admin -a ADMIN ctreeSQL..\..\..\tools\isql -s iSQL_Tutorial2.sql -u admin -a ADMIN ctreeSQL..\..\..\tools\isql -s iSQL_Tutorial3.sql -u admin -a ADMIN ctreeSQL..\..\..\tools\isql -s iSQL_Tutorial4.sql -u admin -a ADMIN ctreeSQL
See the Interactive SQL Command-Line Interface user guide for all of the supported command-line switches.
CLI for Linux
FairCom provides a make file that launches the four Interactive SQL tutorials in sequence with a pause between each tutorial. This can be executed from the command line as follows:
- Open a command shell.
- Change to the
<faircom>/drivers/sql.cli/tutorials/cmdlinefolder. - Execute the following:
make run
The four tutorials can also be run separately and individually from the command prompt as follows:
- Change to the
<faircom>/drivers/sql.cli/tutorials/folder. - Execute each tutorial as follows:
../../../tools/isql -s iSQL_Tutorial1.sql -u admin -a ADMIN ctreeSQL../../../tools/isql -s iSQL_Tutorial2.sql -u admin -a ADMIN ctreeSQL../../../tools/isql -s iSQL_Tutorial3.sql -u admin -a ADMIN ctreeSQL/../../../tools/isql -s iSQL_Tutorial4.sql -u admin -a ADMIN ctreeSQL
See the Interactive SQL Command-Line Interface user guide for all of the supported command-line switches.
SQL Commands
To execute Interactive SQL statements using the FairCom Control Center on Windows, follow the steps below:
- Start the FairCom Control Center (https://localhost:8443/).
- Navigate to the Data tab.
- Select SQL Commands from the Data menu:

- You can use the dropdown menus to see basic SQL examples, or enter and run SQL statements directly in the statement window.
- Select the Collections tab. In the collections text box, enter the name for this collection, “mytutorial”:

- Click the
icon to import SQL statements from a file. - Locate the tutorial files in the
<faircom>\drivers\sql.cli\tutorials\folder and open the one you want to run. - Select Split on semicolons and Append to existing entries, and then Import:

- Select Run All. Query results appear in the output Pane.
- Select the Execution Log to see the results of the individual statements. Note that some commands (such as ECHO) are specific to the ISQL CLI utility and report errors.

- Copy individual statements to the statement area if you want to test individual SQL commands.