Java - Binary keys


#1

Hi,

keys in my database are 8-byte binary numbers. I used Couchbase C SDK to insert key-value pairs into the database. Now I would like to retrieve the inserted values by using the Java SDK, but the Java SDK only allows keys of type String. How do I create String keys from 8-byte binary numbers to retrieve data from the database?


#2

Hi,

An 8-bytes number would be a Long object in Java. Have you try using it then converting it to a String?


#3

I have a solution to this problem but the web interface to this forum is preventing me to post it in a regular way. Here is the answer:

The solution is to edit spymemcached.jar/net/spy/memcached/KeyUtil.java and replace “UTF-8” with “ISO-8859-1”.