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/bintype:xsql -size 100m -p 5000 press Enter to stop SQL serverThis opens an in-memory database session, with database size of
100 Mb, on port5000of 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:5000The following display shows that the xSQL client is ready to accept interactive commands:
To end the client/server session, first close the client by typing the command
exit.XSQL>exitThen 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
xsqlfrom directorytarget/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:
- 100 Megabytes for database storage - the space to be allocated for the database.
MURSIWis the transaction managertransientdatabase objects will be created in conventional memory (RAM)persistent(disk-based) database objects are not supported- the eXtremeDB release mode libraries are loaded
(Note that xSQL can be started with a variety of command-line configuration options, including the
-coption to read configuration specifications from aconfig.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/financialThese sample scripts will be demonstrated in the following steps of this tutorial. Because xSQL automatically loads dynamic libraries located in
eXtremeDB/arget/bin.soit is recommended to start xSQL in theeXtremeDB/target/bindirectory. (Alternatively theLD_LIBRARY_PATHenvironment 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, orxsql.shin Unix-Linux packages, is provided to eliminate the need to type a long relative directory path like..\..\..\..\target\bin\xsql.exeFor 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:xsqlor 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.