Please Help me Guys. I don't know why this code is not showing any image nor any error message. Below are my codes.
ImageIcon img = new ImageIcon(""); JLabel pixLabel = new JLabel(); int chk = 1; try { PreparedStatement prdst = con.prepareStatement("SELECT image FROM fuoye_medical.patient_image WHERE patient_id="+chk); ResultSet rs = prdst.executeQuery(); rs.next(); Blob b = rs.getBlob("image"); byte[] buf = null; buf = b.getBytes(1, (int)b.length()); Image i = Toolkit.getDefaultToolkit().createImage(buf); ImageIcon ii = new ImageIcon(i); Image iii = ii.getImage().getScaledInstance(pixLabel.getWidth(), pixLabel.getHeight(), Image.SCALE_SMOOTH); img = new ImageIcon(iii); pixLabel.setIcon(img); } catch(Exception ex){ ex.printStackTrace(); }