Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8317879
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T21:45:27+00:00 2026-06-08T21:45:27+00:00

I am using Snappy-java to encode JSON data and I want to store the

  • 0

I am using Snappy-java to encode JSON data and I want to store the result in database in a varchar column.
The database is an oracle database with ISO-8859-1 encoding.
I am facing an encoding problem when inserting the data. It would seem that some characters are not recognised by Oracle.

I’ve found a workaround by using Base64 encoding on the compressed data before inserting it. I can then retrieve it just fine 🙂

The problem with that is that Base64 encoding increases the length of the data that I am then storing, hereby reducing the savings gained with Snappy…

So my question is: How can I store that data without encoding it in Base64?
The reason I want to use a varchar is because I want to be able to access the table using an oracle index without ever accessing the table (performance is definitely an issue).

I have tried other compression algorithms as well, but they all seem to have the same problem.
I have also looked at yEnc but I cannot find any java encoder. Moreover I am not sure that I understands all the problems listed with yEnc, so I am bit reluctant using it.

Thanks a lot for any help!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T21:45:28+00:00Added an answer on June 8, 2026 at 9:45 pm

    Thank you all for your help!

    I finally found a workaround.
    Since I am storing bytes and not chars, I am going to use a BLOB to store the data.
    The problem with the BLOB is that it cannot be indexed.
    The alternative is using a RAW type column. It stores bytes and is indexable. Unfortunately it is too small (2000 bytes).
    So, the answer in my case consist in storing the data in BLOB, and access it through an index on two RAW types since the data is never bigger than 4000 bytes.

    The index looks like this:

    CREATE INDEX blob_to_raw_prd_ix 
    ON product (product_id, 
                substr_dt(blob_summary,2000,1), 
                substr_dt(blob_summary,2000,2001));
    

    where

    • blob_summary is the BLOB column i store the data in
    • substr_dt is a user defined deterministic function (defined hereafter)

      CREATE OR REPLACE FUNCTION substr_dt(str BLOB, buffer_size int, offset int) RETURN RAW
      DETERMINISTIC IS
      BEGIN
      RETURN dbms_lob.substr(str,buffer_size,offset);
      END;

    To access the data, I just need to query the product_id and the fields using aliases, e.g.

    SELECT     /*+ index(blob_to_raw_prd_ix) */ product_id, 
                                                substr_dt(blob_summary, 2000, 1) AS summary1, 
                                                substr_dt(blob_summary, 2000, 2001) AS summary2
    FROM       product
    WHERE      (product_id = ?);
    

    In this case, summary_1 represents the first 2000 bytes of the blob, and summary 2 the last 2000 bytes.
    Using concatenation on the two arrays summary1 and summary2 I get the content of the blob.

    That works with Jdbc but I could not make it work with Hibernate (yet).
    It is not the best solution ever as data needs reprocessing before being interpreted. However, it solves the data access problem without the encoding space overhead.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to write a storage backend to store larger chunks of data. The
Using C#, I want to show the image in the Access column but failed
Using a populated Table Type as the source for a TSQL-Merge. I want to
Using Android TelephonyManager an application can obtain the state of data activity over the
Using Java,I have to fetch multiple sets of values from an XML file to
Using rails 3.1, ruby 1.92. I have a bunch of products in a store:
I'm trying to generate PDFs using Snappy PDF . It's working great, except I
Using HTML 5, I want to play multiple sounds simultaneously. how can I do
I'm using a PHP wrapper for wkhtmltopdf called Snappy . It works brilliantly on
Using a textbox to search a value in a given datagridview column, the code

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.