posted 10 years ago
i have successfully displayed image using the below method
Image img = ImageIO.read(new File("F:\\x.jpg"));
g2.drawImage(img,,,,,);
my question is, i am reading an image from database and i want to display that particular image using drawImage() method
here is the code how am retrieving image from database and storing on hard disk
byte[] fileBytes;
fileBytes = rs.getBytes(2);
while(rs.next())
{
OutputStream targetFile = new FileOutputStream("e:/dp.jpg");
targetFile.write(fileBytes);
}
targetFile.close();
i don't want to store the image on hard disk just i want to display that image using drawImage().
please help me -thanks in advance.