Java client for IBM Cloud Databases for Redis

Published on
May 8, 2025

IBM Cloud Databases for Redis is a database as a service (DBaaS) available in the IBM Cloud environment. IBM provides a fully deployed and managed Redis instance for application developers of all types. Although Java lacks native support for Redis, developers can use the Redisson client to interact with Redis. Here’s how to set up and use Redisson, the Java client for IBM Cloud Databases for Redis.

What is IBM Cloud Databases?

IBM Cloud Databases is a cloud-based collection of database services offered by IBM. The platform provides access to popular databases like PostgreSQL, MySQL, MongoDB, Elasticsearch, and the fast, in-memory data store Redis. 

IBM Cloud Databases is a fully managed service, which means IBM handles all aspects of infrastructure management, including software updates and backups. This allows developers to focus on building and deploying high-performance applications.

What is IBM Cloud Databases for Redis?

IBM Cloud Databases for Redis is a fully managed Redis service backed by the IBM Cloud platform. Since IBM takes care of all infrastructure management, the platform makes it easy for developers to leverage Redis's power without the burden of operational overhead.

How Java developers can use Redisson with IBM Cloud Databases for Redis

The open-source Java client Redisson allows developers to work with Redis data structures like any other object. Redisson offers familiar methods, classes, and objects, making it easy for Java programmers to integrate Redis into their projects. For example, Redisson’s RBucket is a general-purpose container for objects with a maximum size of 512 MB. Also, Redisson’s RMap is a map data structure to store objects, associated with each key in the map.

Redisson also supports Java developers working on IBM Cloud Databases for Redis. Here's sample Java code for a single Redis node:

package redis.demo;

import org.redisson.Redisson;
import org.redisson.api.RBucket;
import org.redisson.api.RedissonClient;

public class Application {

 public static void main(String[] args) {

 Config config = new Config();
 config.useSingleServer().setAddress("rediss://e6b2c3f8.databases.appdomain.cloud:3237");

 RedissonClient redisson = Redisson.create(config);

 // perform operations
 RBucket bucket = redisson.getBucket("simpleObject");
 bucket.set("This is object value");
 RMap map = redisson.getMap("simpleMap");
 map.put("mapKey", "This is map value");
       
 String objectValue = bucket.get();
 System.out.println("stored object value: " + objectValue);
 String mapValue = map.get("mapKey");
 System.out.println("stored map value: " + mapValue);
 redisson.shutdown();
 }
}

For high availability mode with two nodes, developers can use Redisson’s proxy mode. Change the line in the above code sample that begins with config.useSingleServer() to this:

connectionconfig.useProxyServers().addAddress("rediss://8f7bfd8f3faa4218aec56e069eb46187.databases.appdomain.cloud:3237");

Redisson and Redisson PRO, the Redis Java clients for IBM Cloud

Redisson and Redisson PRO are the Redis clients for Java developers working on cloud platforms like IBM Cloud for Databases for Redis. Redisson’s familiar Java classes, objects, and methods make it easy for developers to use Redis or Valkey as a cache, database, message broker, and other capabilities. To learn more, check out the feature comparison between Redisson and Redisson PRO.