Step 1: Startup

Starting xSQL as a database server and client

xSQL is an interactive tool for processing SQL statements. It can be run as a server to provide access to eXtremeDB databases from local or remote clients. For example. from directory target/bin type:

 
    xsql -size 100m -p 5000
    press Enter to stop SQL server
     

This opens an in-memory database session, with database size of 100 Mb, on port 5000 of the host computer. A client can be another instance of xSQL that connects to the port specified by the server, or it can be any application using the eXtremeSQL API. To start xSQL as a client process on the same host computer, connecting to the server instance above, use the following command:

 
    xsql @127.0.0.1:5000
     

The following display shows that the xSQL client is ready to accept interactive commands:

     
    xsql started
    Runtime configuration
     Remote node(s)        : 127.0.0.1:5000
     Runtime                          : Release
    XSQL>
     

To end the client/server session, first close the client by typing the command exit.

 
    XSQL>exit
     

Then close the server by pressing <Enter>.

xSQL can be opened in a single interactive server process, so that a separate client process is not necessary, by simply typing xsql from directory target/bin:

 
    xsql
     
    Simple interactive configuration is started
    To run as a server, type, for example: 'xsql -size 100m -p 5000'
    Then to connect as a client, use 'xsql @127.0.0.1:5000'
    Type 'xsql -h' for more details
     
    xsql started
    Runtime configuration
      Transaction manager  : MURSIW
     Storage (transient)  : Conventional memory, 100M
     Storage (persistent) : Not supported
     Runtime                     : Release
    XSQL>
     

Note that, if no command line arguments are specified the default options are equivalent to running with the command line xsql –i –size 100m. As the display indicates, xSQL is running in interactive mode with the following characteristics:

(Note that xSQL can be started with a variety of command-line configuration options, including the -c option to read configuration specifications from a config.file, in addition to the “server” and “client” examples above. All command-line options and configuration file specifications can be viewed here.)

Sample scripts directories

A number of sample SQL scripts, command files (shell scripts) and sample data are provided to facilitate running these examples in the SDK directories:

   
    eXtremeDB/samples/xsql/configs  
    eXtremeDB/samples/xsql/scripts 
    eXtremeDB/samples/xsql/scripts/sequences  
    eXtremeDB/samples/xsql/scripts/financial  
     

These sample scripts will be demonstrated in the following steps of this tutorial. Because xSQL automatically loads dynamic libraries located in eXtremeDB/arget/bin.so it is recommended to start xSQL in the eXtremeDB/target/bin directory. (Alternatively the LD_LIBRARY_PATH environment variable can be exported (set) to indicate the directory from which to load dynamic libraries.)

To simplify launching xSQL from target/bin while remaining in the working directory that contains the script files, the Windows command file xsql.bat, or xsql.sh in Unix-Linux packages, is provided to eliminate the need to type a long relative directory path like

 
    ..\..\..\..\target\bin\xsql.exe
     

For example, using this command file, the following is a minimal command to run xSQL interactively in a Windows console window from directory eXtremeDB/samples/xsql/scripts/financial:

 
    xsql
     

or from a Unix-Linux console window:

 
    ./xsql.sh
     

(For simplicity, throughout the rest of this tutorial Operating System commands will be presented only in the Windows format; Unix-Linux users will know what to do.)

Now we can execute SQL commands interactively. Use this link to go on to Step 2.