Previous Next JavaScript must be enabled to correctly display this content

## 3 The `CountTableRows` Example

Assuming you installed the separate example distribution under the directory `/opt/oracle/nosql/apps/kv/examples`, the `hadoop.table` example package would contain the following source files under the `/opt/oracle/nosql/apps/kv/examples/hadoop/table/` directory:

- `CountTableRows.java`
- `LoadVehicleTable.java`
- `KVSecurityCreation.java`
- `KVSecurityUtil.java`

To run the MapReduce job launched by the `CountTableRows` example Java program, an Oracle NoSQL Database store (secure or non-secure) must first be deployed, and a table must be created and populated with data. Thus, before executing `CountTableRows`, either use the steps outlined in the Deploying a Non-Secure Store appendix to deploy a non-secure store, or use the Deploying a Secure Store appendix to deploy a store configured for security.

Once a store has been deployed, you should execute the standalone Java program `LoadVehicleTable` provided in the example package to create and populate a table with the name and schema expected by `CountTableRows`. Once the table is created and populated with example data, `CountTableRows` can then be executed to run a MapReduce job that counts the number of rows of data in the table.

In addition to the `LoadVehicleTable` program, the example package also contains the classes `KVSecurityCreation` and `KVSecurityUtil`, which are provided to support running `CountTableRows` against a secure store.

The standalone Java program `KVSecurityCreation` is provided as a convenience, and can be run to create (or delete) a password file or Oracle Wallet along with associated client side and server side login files that `CountTableRows` will need to interact with a secure store.

The `KVSecurityUtil` class provides convenient utility methods that `CountTableRows` uses to create and process the various security artifacts needed when accessing the store securely.

The CountTableRows Support Programs appendix explains how to compile and execute the `LoadVehicleTable` program to create and populate the required example table in the store that you deploy. That appendix also explains how to compile and execute the `KVSecurityCreation` program to create or delete any security credentials that may be needed by `CountTableRows`.

The following sections explain how to compile, build (JAR), and execute the `CountTableRows` MapReduce job on the Hadoop cluster that was deployed for this example.