Cloudant Integration1.0
This feature enables connections to Cloudant databases by providing a connector instance that’s configured in the server configuration and can be injected or accessed through Java Naming and Directory Interface (JNDI). Applications use the Cloudant client library to access the connector instance.
Enabling this feature
To enable the Cloudant Integration 1.0 feature, add the following element declaration into your server.xml
file, inside the featureManager
element:
<feature>cloudant-1.0</feature>
Examples
View and validate Cloudant databases
You can view and validate Cloudant database connections by accessing REST endpoints that are automatically enabled by combining the Cloudant Integration feature with the Admin REST Connector feature.
To enable this configuration, in addition to enabling the Cloudant Integration feature, you must also enable the Admin REST Connector feature and the Application Security feature in your server.xml
file:
<library id="CloudantLib">
<fileset dir="server1/cloudant"/>
</library>
<authData id="cloudantAuthData" user="${CLOUDANT_USER}" password="${CLOUDANT_PASS}"/>
<cloudant id="myCloudant" jndiName="cloudant/myCloudant" libraryRef="CloudantLib" url="http://localhost:5984">
<containerAuthData user="cloudantUser" password="cloudantPass"/>
</cloudant>
<cloudantDatabase id="myCloudantDB" jndiName="cloudant/myCloudantDB" cloudantRef="myCloudant" databaseName="testdb" create="true"/>
With this example, the Cloudant configuration can be viewed at the https://localhost:9443/ibm/api/config/cloudantDatabase
endpoint URL, and the myCloudantDB
database can be validated by using container authentication at the https://localhost:9443/ibm/api/validation/cloudantDatabase/myCloudantDB?auth=container
endpoint URL.
Access to both of these endpoint URLs requires authentication with the Open Liberty server. The config
endpoint requires a minimum of reader-role
access, and the validation
endpoint requires administrator-role
access. You can set up secure access with any Open Liberty-supported user registry.