Obtaining a KVStore Handle

To acccess the store for any reason, you must first obtain a KVStore handle, using the KVStoreFactory.getStore() method.

When you get a KVStore handle, provide a KVStoreConfig object to the handle. The configuration object identifies important properties about the store that you are accessing. This section describes the KVStoreConfig class. Minimally, use this class to identify the following information:

In addition to the KVStoreConfig class object, you can also provide a PasswordCredentials class object to KVStoreFactory.getStore(). Do this if you are using a store configured to require authentication, which is recommended. See Using the Authentication APIs for more information.

For a store that does not require authentication, get a store handle like this:

package kvstore.basicExample;

import oracle.kv.KVStore;
import oracle.kv.KVStoreConfig;
import oracle.kv.KVStoreFactory;

...

String[] hhosts = {"n1.example.org:5088", "n2.example.org:4129"};
KVStoreConfig kconfig = new KVStoreConfig("exampleStore", hhosts);
KVStore kvstore = KVStoreFactory.getStore(kconfig);

Using the KVStoreConfig Class

Use the KVStoreConfig class to describe properties about a KVStore handle. Most of the properties are optional, and those that are required are provided when you construct a class instance.

The properties that you can provide using KVStoreConfig are as follows:

String[] hhosts = {"n1.example.org:3333", "n2.example.org:3333"};