Running the SQL Shell

You can run the SQL shell interactively or use it to run single commands. Here is the general usage to start the shell:

java -jar KVHOME/lib/sql.jar
       -helper-hosts <host:port[,host:port]*> -store <storeName>
       [-username <user>] [-security <security-file-path>]
       [-timeout <timeout ms>]
       [-consistency <NONE_REQUIRED(default) |
                              ABSOLUTE | NONE_REQUIRED_NO_MASTER>]
       [-durability <COMMIT_SYNC(default) |
                              COMMIT_NO_SYNC | COMMIT_WRITE_NO_SYNC>]
       [single command and arguments] 

where:

  • -consistency

    Configures the read consistency used for this session.

  • -durability

    Configures the write durability used for this session.

  • -helper-hosts

    Specifies a comma-separated list of hosts and ports.

  • -store

    Specifies the name of the store.

  • -timeout

    Configures the request timeout used for this session.

  • -username

    Specifies the username to login as.

For example, you can start the shell like this:

java -jar KVHOME/lib/sql.jar
-helper-hosts node01:5000 -store kvstore
sql->

This command assumes that a store kvstore is running at port 5000. After the SQL starts succcessfully, you execute queries. In the next part of this document, you will find an introduction to SQL for Oracle NoSQL Database and how to create query statements.

If you want to import records from a file in either JSON or CSV format, you can use the import command. For more information see import.

If you want to run a script, use the load command. For more information see load.

For a complete list of utility commands accessed through "java -jar" <kvhome>/lib/sql.jar <command> see Shell Utility Commands.