Connect to the Cluster Using SQLF

sqlf implements a command-line tool that is based on the Apache Derby ij tool. You can use sqlf to connect to a SQLFire cluster and run scripts or interactive queries. You execute sqlf using the sqlf or sqlf.bat script.

  1. In the same command prompt or terminal Window in which you started the SQLFire cluster, change to the quickstart directory:
    cd quickstart

    The quickstart directory contains example SQL script files that you will use later in the tutorial.

  2. Start an interactive sqlf session:

    This command starts the interactive shell and displays the prompt: sqlf>.

  3. Print a brief list of the available sqlf commands:
  4. To connect to the SQLFire cluster using the JDBC thin client driver, use the connect client command and specify the host and port number of the SQLFire locator:
    connect client 'ip_address:1527';

    Notice that SQLFire does not have the concept of a "database". When you connect to a SQLFire cluster, the distributed system that you connect to is defined by the locator (or alternately, the mcast-port) specified in the JDBC or ADO.NET connection.

  5. Use the following command to view tables in the "sys" schema:
    show tables in sys;

    You will use information from many of these tables to view information and statistics about a working SQLFire cluster.

  6. The sys.members table stores information about the SQLFire members. Execute the following query to see the unique ID assigned to the two SQLFire servers and the locator that you started:
    select id from sys.members;

    You will see output similar to:

    localhost(41149)<v0>:32977/50114                                                                                           <v1>:49915/50462                                                                                                 
    3 rows selected
    The output displays the member process ID that is also logged when you start the members at the command line (41149, 41502, and 41533 in the tutorial example).