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 1015601
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T10:25:31+00:00 2026-05-16T10:25:31+00:00

i want to save a lot of binary data files(pdf, images, office docs…) into

  • 0

i want to save a lot of binary data files(pdf, images, office docs…) into one single “blob” file. now i’m not sure what is better, saving stuff with java Serializable and save things to disc or to use a database like sqlite to make things happen. or is there a third, maybe better way?
my question is, how well do those methods perform in terms of access speed and data-integrety.
in this one single blob file there will be one day maybe a hundreds of pdf files in.
what way would you prefer?

  • 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-05-16T10:25:31+00:00Added an answer on May 16, 2026 at 10:25 am

    Definitely don’t use java.io.Serializable. Just write binary data as-is to its target. Serializing would only add unnecessary overhead and would make the saved data unusable for other tools than Java.

    I also wouldn’t push it all in a single field in a single row. It makes it all tight coupled and storing/retrieving the individual entries may be more expensive. Rather store each in its own row. You can if necessary link/reference the one and other by another column with a foreign key.

    Now the Java code, the JDBC API offers PreparedStatement#setBinaryStream() to save binary data in flavor of an InputStream into the database. There’s also the setBytes() method for the case you’ve it in a (memory hogging) byte[]. Then, to retrieve it, you can just use either ResultSet#getBinaryStream() or getBytes().

    You can on the other hand also just store those files in the local disk file system the usual Java IO way using FileOutputStream and read them using FileInputStream. You can if necessary store file paths/names in the database. This decouples the binary data from the database which makes it less portable, but better reuseable for other purposes.

    See also

    • JDBC PreparedStatement tutorial
    • Java IO tutorial
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to save webpage in document directory with the images,css and javascripts etc..
I want to save and load my xml data using XmlReader. But I don't
I'm going to use SQLite in order to save a lot of data in
Can somebody give me some tips about storing a lot of data into a
I save data using binary serialization. Now I have changed a field in the
In my database I want to save the user GUI settings for one of
Let's say you have a List<List<Boolean>> and you want to encode that into binary
I want to read a image in binary mode so that I could save
I want to save a lot of strings with SharedPreferences class . These strings
I want save the username and password when user login, and I added the

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.