Appendix A. Introduction to the SQL for Oracle NoSQL Database Shell

This appendix describes how to configure, start and use the SQL for Oracle NoSQL Database Shell to execute SQL statements. Then, the available shell commands are described.

You can use the shell to directly execute DDL, DML, user management, security, and informational statements.

Running the shell

The shell is run interactively or used to run single commands. The general usage to start the shell is:

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-> 

The above command assumes that a store "kvstore" is running at port 5000. You can now execute queries. In the next part of the book, you will find and introduction to SQL for Oracle NoSQL Database and how to create these 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 file, you can use the "load" command. For more information see load.

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