Usage of Cloudant NoSQL Databases in XPages Applications

IBM Bluemix provides various database services, one of them is the Cloudant NoSQL DB. Cloudant provides a REST API and many client libraries to access the service. In the past I’ve used the Java API Ektorp for other projects.

Today I tried how to use this API from XPages which is a JSF based runtime running on IBM Domino which comes with it’s own NoSQL database but you can also use other databases. In January IBM previewed how to run XPages applications on Bluemix. But even today when running XPages on premises you could leverage other Bluemix services like Cloudant. Below is a high level description how to do this.

To create a new Cloudant account developers can register at and create a new account from the Bluemix catalog. After this you can find the credentials in the expandable section and open the Cloudant dashboard by clicking on the service.

In order to use the Ektorp API in the XPages Java code several libraries have to be imported.

In order to access a database the following code worked for me. However note that I’m using deprecated classes for the SSL and trust everything which you shouldn’t do for production apps. I also changed my Java security policies. The Cloudant credentials I hardcoded in the Java code for which there will be a better solution once XPages can be run on Bluemix.

To get started with Cloudant check out their website for developers. There is a lot of documentation, samples and a big community.