Using the Java Thin OJAI Client

Starting with MEP 6.3.0, you can use the Java Thin OJAI client to write MapR Database JSON applications. The thin OJAI client provides you with a lightweight library that supports the OJAI API. You can connect to MapR Database JSON, and add, update, and query documents in a MapR Database JSON table.

Java Thin OJAI Client Benefits

The client provides you with the following benefits:

  • Easy installation and use
  • Access to MapR Database JSON through the OJAI interface
  • An OJAI interface that is tailored to Java developers
  • Support for L3/L4 (transport level) and L7 (application level) proxy load balancing

Comparing the Java OJAI Client and the Java Thin OJAI Client

Note these considerations when deciding whether to use the Java OJAI Client or the Java Thin OJAI Client:
  • Both the Java OJAI client and Java Thin OJAI Client use the same API (Java OJAI Client API).
  • The Java OJAI client is more scalable, more performant, and more fault tolerant, but also more complicated to deploy. See Using the Java OJAI Client.
  • The Java Thin OJAI Client requires you to specify the service (MapR Data Access Gateway) to which you will connect.
  • The Java Thin OJAI Client is a pure Java client, while the Java OJAI client requires a JNI library.

Installing the MapR Data Access Gateway

To use the Java Thin OJAI client, you must install the MapR Data Access Gateway on your MapR cluster. The gateway serves as a proxy for translating requests between the Java Thin OJAI client and the MapR cluster. To administer the gateway and configure load balancing, see Administering the MapR Data Access Gateway.

Java Thin OJAI Client Security

The client supports username/password authentication. The initial connection (and token renewal) use these credentials. Subsequent communication uses JWT.

When connecting to a secure MapR cluster, the client uses:

  • X.509 certificates to authenticate with the MapR Data Access Gateway
  • TLS v1.2 to encrypt communication between the client and the Data Access Gateway

Java Thin OJAI Client Connection String

The string you use to connect your OJAI client to a MapR cluster must have the following format:


The prefix ojai:mapr:thin:v1@ is optional.

Name of the MapR Data Access Gateway host
Port number (see Ports Used by MapR) that gRPC clients use to connect to the MapR Data Access Gateway

Default: 5678


The authentication scheme for the current connection; currently, only basic


The user name for basic authentication


The password for basic authentication


Whether to establish a secure connection using SSL/TLS

An error is returned if there is a mismatch between your client and cluster security settings. The default for this option is true, which is the required setting if connecting to a secure MapR cluster. If connecting to a nonsecure MapR cluster, set it to false.

If set to false, the other SSL parameters are ignored.

sslCA=<path to PEM file containing CA certificate>

Path to a local file containing Certificate Authority (CA) signed certificates in PEM format.

Must be set if the ssl option is true.

Other examples of connection strings are the following:


Maven Coordinates

The Maven coordinates are:

Additional Resources