Java - Binary keys

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?

1 Answer

« Back to question.

Hi,

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

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".