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

  • Home
  • SEARCH
  • 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 8301353
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T16:54:39+00:00 2026-06-08T16:54:39+00:00

I want to store Image into a SQLite Database in Blackberry.. so what i

  • 0

I want to store Image into a SQLite Database in Blackberry.. so what i have to do?? I want to fetch images from server and then want to store in database.. I got images from server perfectly and store image as byte[] in database.. but i am not able to fetch it..
So plz help me…

Code edited into the question so it may be read:

try {
   Statement st = db.createStatement("SELECT * FROM Image");
   st.prepare(); 
   Cursor c = st.getCursor();
   Row r;
   while(c.next()) {
      r = c.getRow();
      byte[] pic=r.getBlobBytes(0);
      st.close();
      EncodedImage _bmap = EncodedImage.createEncodedImage(pic, 0, pic.length);
      BitmapField bmf=new BitmapField(_bmap.getBitmap());
      add(bmf);
   }
} catch ( Exception e ) {
   System.out.println( e.getMessage() );
   e.printStackTrace();
}
  • 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-08T16:54:42+00:00Added an answer on June 8, 2026 at 4:54 pm

    Your code doesn’t mention the name of the blob column, so I will call it image_data. Something like this should work for insertion:

    EncodedImage pic = getImage();
    byte [] imageBytes = pic.getData();
    Statement st = db.createStatement("INSERT INTO Image (image_data) values (?)");
    st.prepare();
    st.bind(1, imageBytes);
    st.execute();
    

    For retrieval, explicitly naming the column may help, as your current code assumes the blob is always the first column in the table schema. Also, you shouldn’t close the statement in the loop, as this will block reading anything after the first image:

    Statement st = db.createStatement("SELECT image_data FROM Image");
    st.prepare(); 
    Cursor c = st.getCursor();
    Row r;
    while(c.next()) {
       r = c.getRow();
       byte[] pic=r.getBlobBytes(0);
       EncodedImage _bmap = EncodedImage.createEncodedImage(pic, 0, pic.length);
       BitmapField bmf=new BitmapField(_bmap.getBitmap());
       add(bmf);
    }
    st.close();  // moved this line out of the loop
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to store an image(from url) into a sqlite database. For that I
I want to store the Image into my Server side Database. Once the user
I have the number of images from the gallary. I want to store the
I want to store my Bitmap image into project directory. How can I have
Basically i want to store a path to an image into the database Example:I
Hi i want to store images into database.I created table with fields like imgID
I want to store images into sql using c# application. So I have this
I want to store an image in my SQLITE db. I checked out the
When I click on an image, I want to store that particular images src
I want to access an image stored in Blackberry, say at location store/home/user/image.png .

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.