Use the IBM®
Bluemix® utility
command-line integration tool to configure your Liberty server to use the Bluemix
Cloudant® service.
Before you begin
Before you configure your
Liberty server to use
Bluemix services, you must create an
account. See
Sign up for IBM Bluemix to create your
Bluemix account.
About this task
Configure your Liberty server to
use the Cloudant service. For more
information about Cloudant, see Getting started with Cloudant NoSQL DB.
Procedure
- Log in using the bluemixUtility login command. After your initial login, you
do not have to complete this step again.
- Run the bluemixUtility marketplace command to list details about all the Bluemix services that can be used with the
command-line utility. See the following example:
Service: cloudantNoSQLDB
Description: Cloudant NoSQL DB is a fully managed data layer designed for modern web and mobile applications that leverages a flexible JSON schema.
Cloudant is built upon and compatible with Apache CouchDB and accessible through a secure HTTPS API, which scales as your application grows.
Cloudant is ISO27001 and SOC2 Type 1 certified, and all data is stored in triplicate across separate physical nodes in a cluster for HA/DR within a data center.
Documentation: https://console.ng.bluemix.net/docs/#services/Cloudant/index.html#Cloudant
Plans: Standard, Lite
Note: If you already created an instance, skip to step 4. You can also create an instance from the
Bluemix dashboard.
Run the bluemixUtility createService [options]
serviceType
servicePlan
serviceName command to create an instance of the Bluemix services that you want to use. See the following example and description of a service listed:
bluemixUtility createService cloudantNoSQLDB Lite myCloudantService
- Optional: Run the bluemixUtility listServices command to view the Name, Type, and Plan
of all the services instances that you created. See the following example:
myCloudantService cloudantNoSQLDB Lite
- Run the bluemixUtility import myCloudantService --pversion=v2 command to
import the configuration.
Important: The
--pversion=v2 option installs the
cloudant-1.0 feature and downloads the official
Cloudant library for Java. For API
information, see the
official Cloudant Java library API
documentation. If you omit the
--pversion=v2 option, the
couchdb-1.0 feature is installed and Ektorp libraries are used instead to
communicate with the
Cloudant
instance.
- Accept the license terms and conditions of the necessary libraries that are needed to access
the service.
- After the configuration is successfully imported, complete any additional steps to use the
imported configuration in your application, such as adding a classloader reference to the library.
For example, you must add the following classloader reference to your application to use the
downloaded libraries.
<application id="myCloudantApp">
<classloader commonLibraryRef="cloudantNoSQLDB-library"/>
</application>
- Optional: Run the bluemixUtility listImports command to view the
service configurations that you imported.
The following IBM Bluemix service configurations have been imported:
myCloudantService
- Run the bluemixUtility bind [options]
serverName
serviceName to bind the configuration to a Liberty server. Accept the license terms
and conditions, if you are prompted. See the following example and description of a service listed:
bluemixUtility bind defaultServer myCloudantService
Checking if features required for the myCloudantService are installed.
All required features are installed.
The myCloudantService is now bound to defaultServer server.
If you imported the service with the --pversion=v2 option to use the
official Cloudant Java libraries, the
default JNDI name for the Cloudant
database is cloudant/serviceName. If you did not specify that
option, the default JNDI name is couchdb/serviceName. If your
application references the database by using a different JNDI name, use
--vjndiName option to specify the JNDI name. $ bluemixUtility bind defaultServer myCloudantService --vjndiName=couchdb/connector
Results
You can now use
Cloudant
services with your
Liberty
server.