DB2 NoSQL JSON Feature (ii) using command line processor

Source: Internet
Author: User
Tags command line db2 ibm db2 json create database port number linux

How to set up and use the DB2 NoSQL JSON command line interface

Before you start

DB2 NoSQL JSON is a technology preview version provided in DB2 for Linux, UNIX, and Windows 10.5, which provides the following features, as shown in Figure 1:

A command line shell that manages and queries JSON data.

A Java API for application development.

A Wire Listener that accepts and responds to requests sent over the network.

Figure 1. DB2 JSON Component

Understand what can be learned from the literature and how to master the knowledge in this article

This article describes the basic features of DB2 NoSQL managing JSON data and executing queries in a command-line shell, and will guide you through the following tasks:

Set up

Working with collections and documents

Management

Clean

For more information about general overviews and other components, see the other articles in this series.

Set up

System Prerequisites

To complete the following steps, you must have at least IBM DB2 10.5 for Linux, UNIX, and Windows installed on your system. To simplify the administration of the licensing requirements for the examples in this article, make sure that you have the DBADM authorization for the database you want to use. If you create the database described in the next section, the necessary authorizations are automatically assigned.

Create a database

In this step, you create a database that is appropriate for subsequent examples. Use a DB2 command window or your favorite DB2 administration tool to execute the command, as shown in Listing 1.

Listing 1. command to create Database

CREATE DATABASE myjsondb 
       automatic storage Yes 
       using codeset Utf-8 territory US 
       collate using System  
       PageSize K

Also note the database server host name or IP address, and the port number. You need to use them next.

Preparing and starting the JSON command line processing environment

The command-line processor starts using the Db2nosql script (located in the <db2home>/sqllib/json/bin directory) and requires database connection information. To ensure that dependencies are resolved, you can verify the following:

PATH contains a Java runtime environment (minimum JRE 1.5).

CLASSPATH contains the JDBC driver (Db2jcc.jar or Db2jcc4.jar).

The script assumes that the database is on top of localhost:50000 unless you specify a different location or port using the-hostname and-port options. You can use the-HELP option to learn more about the details, as shown in Listing 2.

Listing 2. Examples of using Db2nosql scripts

Db2nosql-help
    
db2nosql-db bobdb  -user bob-password mypassword db2nosql-hostname bob.bobhome.com-port
    
50003-db bobdb  -user bob-password mypwd

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.