JCMT image here


Previous: Isql Up: TMS Utilities Next: Emsql

SQSH Home Page Link to SQSH home page

2.7 Sqsh

- Interactive database shell


sqsh [-a count] [-A packet_size] [-b] [-B] [-c cmdend] [-d severity]
     [-D database] [-e] [-E editor] [-f severity] [-h] [-H hostname]
     [-i filename] [-I interfaces] [-J charset] [-k keywords] [-l level]
     [-m mode] [-L var=value] [-o filename] [-p] [-P password]
     [-r sqshrc] [-s colsep] [-S server] [-U username] [-v] [-w width]
     [-X]  [-y dir] [-z language]
 -a  Max. # of errors before abort       -l  Set debugging level
 -A  Adjust TDS packet size (512)        -m  Set display mode (normal)
 -b  Suppress banner message on startup  -L  Set the value of a given variable
 -B  Turn off file buffering on startup  -o  Direct all output to file
 -c  Alias for the 'go' command          -p  Display performance stats
 -d  Min. severity level to display      -P  Sybase password (NULL)
 -D  Change database context on startup  -r  Specify name of .sqshrc
 -e  Echo batch prior to executing       -s  Alternate column separator (\t)
 -E  Replace default editor (vi)         -S  Name of Sybase server ($DSQUERY)
 -f  Min. severity level for failure     -U  Name of Sybase user
 -h  Disable headers and footers         -v  Display current version and exit
 -H  Set the client hostname             -w  Adjust result display width
 -i  Read input from file                -X  Enable client password encryption
 -I  Alternate interfaces file           -y  Override value of $SYBASE
 -J  Client character set                -z  Alternate display language
 -k  Specify alternate keywords file    

Suggested .sqshrc file

       For JAC standard behaviour install a file with the following 
       two lines as .sqshrc in your home directory (include

       \set banner=0
       \set semicolon_hack=1


       Sqsh (pronounced skwish) is short for SQshelL  (pronounced
       s-q-shell),  and is intended as a replacement for the ven-
       erable 'isql' program supplied by Sybase.  It  came  about
       due to years of frustration of trying to do real work with
       a program that was never meant to perform real work.

       Sqsh is much more than a nice prompt (a  la  'dsql',  from
       David  B.  Joyner),  it is intended to provide much of the
       functionality provided by a good shell, such as variables,
       aliasing, redirection, pipes, back-grounding, job control,
       history, command substitution, and dynamic  configuration.
       Also, as a by-product of the design, it is remarkably easy
       to extend and add functionality.



       Upon  startup,  sqsh  initializes all internal environment
       variables, commands, and aliases to their default  values,
       it  then  looks  for  the  file $HOME/.sqshrc (this may be
       would be using the -i flag.

       The .sqshrc file may contain anything that could  normally
       be typed at the prompt, however it should be noted that at
       the time this file is read sqsh has  yet  to  establish  a
       connection  to  the  database,  however most commands that
       perform database activity, such as  \go  will  attempt  to
       establish a database connection when executed (it may also
       prompt  you  for  a  password  if  necessary).   Also,  if
       database  activity  is  required within this startup file,
       the \connect command (see COMMANDS,  below)  may  be  exe-

       After the .sqshrc file has been executed, sqsh then parses
       any command line options (thus any variables set  in  your
       .sqshrc  file  may be overridden by command line options).
       Following that, if sqsh is run in interactive  mode  (i.e.
       without  -i  and  if  stdin is attached to a tty), it then
       looks for .sqsh_history and loads  the  contents  of  that
       file into this history buffer (see BUFFERS, below).

       Immediately  prior  to  establishing  a  connection to the
       database (either during startup, or by an  explicit  \con-
       nect  or \reconnect command), the file $HOME/.sqsh_session
       is executed.  The name of  this  file  may  be  overridden
       using the $session variable.


Basic Options

       -o filename    Redirects all  output  to  filename  rather
                      than stdout.

       -P password    The  Sybase  password for username required
                      to connect to server (default, NULL).   The
                      password may also be set via $password.
                      password on the command line is somewhat of
                      a  security  hole, as any other user may be
                      able to discover your password using ps(1).
                      It  is  recommended that your default pass-
                      word be stored in a .sqshrc file  which  is
                      not readable by anyone other than yourself.

       -S server      The name of the Sybase server  to  connect,
                      the  default  of this is the external envi-
                      ronment variable $DSQUERY.  This value  may
                      also  be  set  via  the  internal  variable

       -U username    The  Sybase  username  to  connect  to  the
                      database  as, this defaults to the username
                      of the user running sqsh.  The username may
                      also be set via the $username variable.

       -w width       The maximum output  width  of  a  displayed
                      result  set, this defaults to 80 (the maxi-
                      mum for this value is 256).


Online Documentation and full man page

See Also

Using Isql
SQL Tutorial


Previous: Isql Up: TMS Utilities Next: Emsql

JACH | JCMT | UKIRT | Computer Services | JCMT TMS
[ JACH | JCMT | UKIRT | Computer Services | JCMT TMS ]

Please address any comments, suggestions or requests to:

Remo Tilanus

Last modified: Thu Jan 6 15:58:16 HST 2000