ISQL tutorial
FairCom Interactive SQL - quick start tutorial
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:
Start up the FairCom Database Engine. See Installing FairCom Products.
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
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:
Open a Windows command prompt.
Change to the
<faircom>\drivers\sql.cli\tutorials\cmdline\
folder.Run the
BuildTutorials.bat
file.
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
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:
Open a command shell.
Change to the
<faircom>/drivers/sql.cli/tutorials/cmdline
folder.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
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.
Start the FairCom browser-based tools (https://localhost:8443/) menu.
Select Data Explorer, then connect to the server.
You can use the "SQL queries" and "SQL Scripts" tabs to run SQL statements and scripts.
Select the "SQL Scripts" tab
Click the icon to upload a script file.
Locate the tutorial files in the
<faircom>\drivers\sql.cli\tutorials\
folder and open the one you want to run.Click the Run All button to see the results.
Repeat to run each of the tutorials.
Select the "SQL Queries" tab if you want to test individual SQL commands.