JSON command-line interface (CLI)

Use the command-line interface (CLI) to interact dynamically with the JSON collections and harness Db2® NoSQL capability. The CLI requires a Java™ runtime environment (JRE) of version 1.5 or above.

There are three ways to interact with the command line:
  • Start an interactive shell by specifying the URL, user ID, and password.
    The following is a sample command to start the interactive shell:
    java -cp nosqljson.jar;db2jcc.jar;db2jcc_license_cisuz.jar;
    js.jar com.ibm.nosql.json.cmd.NoSqlCmdLine 
    --url jdbc:db2://localhost:50000/jsondb --user tonysun --password **** 
  • Run a .js file. The command line runs the .js file instead of through a shell. The application ends after all the commands are completed.
    The following is a sample command to run a JavaScript file:
    java -cp nosqljson.jar;db2jcc.jar;db2jcc_license_cisuz.jar;
    js.jar com.ibm.nosql.json.cmd.NoSqlCmdLine 
    --url jdbc:db2://localhost:50000/jsondb; --user tonysun 
    --password **** --file "file.js" 
  • Evaluate a command, by using the eval command. The command line runs a one line command and then the applications ends.
    The following is a sample command:
    java -cp nosqljson.jar;db2jcc.jar;db2jcc_license_cisuz.jar;
    js.jar com.ibm.nosql.json.cmd.NoSqlCmdLine 
    --url jdbc:db2://localhost:50000/jsondb; --user tonysun 
    --password **** --eval "db.things.find()"