I want to add a image in my JFrame from database. But this is not retrived. I use following code, is this right way to retrive image from database? What's the solution???
Blob blob = rs.getBlob("image");
int blobLength = (int) blob.length();
byte[] bytes = blob.getBytes(1, blobLength);
//blob.free();
BufferedImage image = ImageIO.read(new ByteArrayInputStream(bytes));
ImageIcon icon = new ImageIcon(bytes); // you can read straight from byte array
l16 = new JLabel(icon);
l16.setBounds(100, 100, 100, 50);
add(l16);