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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T14:19:47+00:00 2026-05-24T14:19:47+00:00

I am using sqlite and java as programming language. I have a class which

  • 0

I am using sqlite and java as programming language. I have a class which is

public class DataSet {

    public ArrayList<Double> a = null;
    public ArrayList<Double> b = null;
    public ArrayList<Double> c = null;

    public DataSet() {
        a = new ArrayList<Double>();
        b = new ArrayList<Double>();
        c = new ArrayList<Double>();
    }
}

I want to store DATA, where DataSet DATA=new DataSet(); in sqlite. But I am looking to do it once( not in a for loop to get data one by one). Is there any dataset which I can use that and store the whole thing like an image in a C#?

  • 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-24T14:19:48+00:00Added an answer on May 24, 2026 at 2:19 pm

    You want to store the object like an Image? So as a whole… Make the object Serializable like this:

    public class DataSet implements Serializable {
      /* this is the version of this class,
         increment, when you change the implementation */
      public static final serialVersionUID  = 1L;
      ...
    }
    

    And store the binary result into a byte array with an ObjectOutputStream. This byte array you can save into your database as a BLOB. For example if your table has an id and a data column:

    byte[] data;
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    ObjectOutputStream oos = new ObjectOutputStream(bos);
    try {
      oos.writeObject(DATA);
      data = bos.toByteArray();
    } finally {
      oos.close();
    }    
    
    PreparedStatement pstmt = jdbcConnection.prepareStatement(
        "insert into MYTABLE (id, data) values (?, ?)");
    pstmt.setLong(1);
    pstmt.setBlob(2, new ByteArrayInputStream(data));
    
    ...
    

    Commit the data, close the connection. Warning: This code is not tested…

    Reading the blob from the database again you can use an ObjectInputStream on the byte array you get from the BLOB just as above only the other way around. I leave that for you to code.

    Please remember that storing data in a serialized way it will not be human-readable, so you can not open your SQLite, look into it and find out if your data is reasonable.

    Good luck!

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

Sidebar

Related Questions

I am using the SQLite database and have the following persistent class (simplified): public
What's the best way to get the last inserted id using sqlite from Java?
Does anyone have any examples of using Sqlite with ASP.NET membership? I am building
I have a database file that is generated on a PC using Sqlite. This
I am using SQLite in Java code through Zentus . I need to map
I am using SQLite in a Java application through Zentus . In this context
I'm using a Java wrapper for accessing Sqlite but I assume this is a
I'm using SQLite for a simple attendance tracking application to be implemented in Java.
I'm using SQLite to maintain a database which contains, among other things, a table
I'm making dictionary, it have over 50000 rows. Now, I'm using sqlite for 30000

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.