Skip to main content

ISQL tutorial

FairCom Interactive SQL - quick start tutorial

FairCom_DB_Horizontal_logo.svg

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:

  1. Start up the FairCom Database Engine. See Installing FairCom Products.

  2. Optionally read the Introduction to ISQL.

  3. Run SQL statements in any of the following ways:

    Note

    When running the tutorials, tutorial #4 will throw four “Constraint violation” errors.

    …error(-20116): Constraint violation 
    NOTE: constraint violation expected

    This is expected and indicates correct behavior.

    Note

    If you get the following error:

    error in tcp bind 111
    error(-20212): Error in Network Daemon

    The 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.

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.

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:

  1. Open a Windows command prompt.

  2. Change to the <faircom>\drivers\sql.cli\tutorials\cmdline\ folder.

  3. Run the BuildTutorials.bat file.

The four tutorials can also be run separately and individually from the command prompt as follows:

  1. Change to the  <faircom>\drivers\sql.cli\tutorials\ folder.

  2. 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

    Note

    See the Interactive SQL Command-Line Interface user guide for all of the supported command-line switches.

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:

  1. Open a command shell.

  2. Change to the <faircom>/drivers/sql.cli/tutorials/cmdline folder.

  3. Execute the following:

    make run

The four tutorials can also be run separately and individually from the command prompt as follows:

  1. Change to the  <faircom>/drivers/sql.cli/tutorials/ folder.

  2. 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

    Note

    See the Interactive SQL Command-Line Interface user guide for all of the supported command-line switches.

To execute Interactive SQL statements using FairCom Data Explorer on Windows, follow the steps below.

  1. Start the FairCom browser-based tools (https://localhost:8443/) menu.

  2. Select Data Explorer, then connect to the server.

    You can use the "SQL queries" and "SQL Scripts" tabs to run SQL statements and scripts.

    Picture1.svg
  3. Select the "SQL Scripts" tab

    Picture2.svg
    1. Click the Picture3.svg icon to upload a script file.

    2. Locate the tutorial files in the <faircom>\drivers\sql.cli\tutorials\ folder and open the one you want to run.

    3. Click the Run All button to see the results.

    Repeat to run each of the tutorials.

  4. Select the "SQL Queries" tab if you want to test individual SQL commands.