Im using this code to get image from SQLITE

try{

          String sql = "SELECT Photo FROM Pics WHERE InvoiceNumber=?";
          pst = conn.prepareStatement(sql);


          rs=pst.executeQuery();

          if(rs.next()){
              byte[]imagedata = rs.getBytes("Photo");
              format = new ImageIcon(imagedata);

              ImIc.setIcon(format);

          }

      }catch(Exception e){
      JOptionPane.showMessageDialog(null, e);
      }

private ImageIcon format = null;

String filename = null;

int s=0;
byte[] bill_image = null;

how to fix this?
I get no result

Hi altgen,

why you are storing images into DB.i think it is not a best practice.
instead of that store image path into DB and refer that path to the image which is in your page.

try this idea once

reply me incase if you have any doubts in the response

best of luck

actually, storing the images inside the database is a very good idea as it prevents your data from getting corrupted if the location on the filesystem where the images exist changes.
Of course there's some added cost in time needed for retrieval and possibly higher storage requirements, but for real world applications those are of miniscule concern as compared to data integrity.

Hi Ihelpyou,
sorry to tell you but you gave me a wrong name :) but no problem

and as jwenting says if change the file location, it wont find it .

but thank you for both of your suggestions, but I found a good way to make the pic system.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.