tags:

views:

568

answers:

5

The official Redis homepage lists JDBC-Redis and JRedis. What are the advantages / disadvantages of each ? Are there any other options ?

+2  A: 

JDBC-Redis is just a JDBC wrapper for JRedis database.
If you plan on using your code with different back-ends then JDBC is a good way to go. NOTE: It is not a complete JDBC implementation and the NOSQL will bleed through.
If you are going to stay with Redis then I would suggest using the API, which will give you more flexibility. Use a DAO layer pattern to encapsulate your DB Access and down the road that is all you will need to change.

Romain Hippeau
Redis syntax is completely different from standard SQL so using JDBC doesn't help encapsulating different back-ends as you suggest: I would have to write new queries anyway...
muriloq
@muriloq - but the mechanical acquiring and releasing resources is standard.
Romain Hippeau
+4  A: 

You can use also Jedis, which is also in the official Redis homepage. It is compatible with the latest version of Redis. You can find it here: http://github.com/xetorthio/jedis

xetorthio
+3  A: 

Both Jedis and JRedis are being actively developed.

Spring provides a wrapper around both implementations and they're providing serialization/deserialization, amongst other things:

Person p = new Person("Joe", "Trader", 33);
template.convertAndSet("trader:1", p);
Person samePerson = template.getAndConvert("trader:1", Person.class);
Assert.assertEquals(p, samePerson);     

http://git.springsource.org/spring-data/spring-keyvalue-redis/

opyate