602SQL Documentation Index  

Console Client Configuration on Linux

A simple console client is a part of the 602SQL installation package for Linux. It's provided both in the compiled form (602cliXX (XX is a version number) file in the /usr/bin folder) and the commented source code form as an example for 602SQL clients programming using the C/C++ API.

The console client is executed by the 602cliXX command. Its appearance and functionality can be modified using various switches that can be set in the command line or in the /etc/602sql configuration file. For using all switches use the command

602cliXX -h

These entries can be specified in the [.602client] section of the configuration file:

ServerName=name of a registered server
LoginName=user name
Application=application name
DispAttrName=0|1 (show column names after the SELECT command)
DispAttrType=0|1 (show column types after the SELECT command)
DispRecNum=0|1 (show record number after the SELECT command)
DispTextLen=bytes (number of characters of variable-length columns)
Verbose=0|1 (more|less communicative mode)
If there's no name and password specified, a client is logged in as Anonymous. The DispMode parameter sets the way of displaying records after the SELECT command: 0=one record is displayed, each column on each row; 1=each record is displayed as one row. The DispDescr parameter specifies additional information about displaying of some columns (character code for Char, number of bytes for Text etc.)

The values of switches set in the command line have higher priority than the values in the configuration file.

Working with the Client

A special prompt (602cliXX:) for specifying SQL statements is displayed after a successful connection to a server. Commands that were executed in the client can be selected using the up and down arrows. The commands are executed on Enter keystroke. If executing the SELECT command its result is displayed in the console, if executing any other command the server reaction is displayed (error message or confirmation of execution). The console client is terminated by the q key.

Apart from the SQL commands, these special commands may be executed:
connect <server>connect to a new server (without logging in)
login <name> [<password>]log in after a successful connect
serversshow a list of servers that can be accessed
application <application name>open an application in the selected database
statusdisplay parameters of the current connection

Application Import

If you need to import an application using the console client, type the following:
602cliXX [-s<ServerName> -l<Login> -p<Password>] -i<AplFile> [-I<ImportFlags> -A<AlternateName>]
If a server name and username are not specified, they have to be set in the configuration file (see above). The AplFile sets the full path to the APL file with the application definition. If an application name duplicity may occur on the server, it can be solved with the ImportFlags and AlternateName parameters. These parameters have the same meaning as in the Import_appl_param function.

Console Client Usage in Scripts

The console client can be used as a part of scripts (e.g. installation scripts). The simplest example is the execution of an order of SQL commands stored in a text file (each command on a new line, no SELECT command). Let the name of this file be input.sql; the execution of commands is run by this script:

cat input.sql | 602cliXX &>/dev/null
The console clients parameters are read from the configuration file in this example.