title: How to convert byte array to blob
body: <p>I want to fetch an image from database. For that I have created a byte array for an image, which is passed by a string, and now I want to convert that string into image format. I am assigning that image to a Jlabel field. The code is as follows:</p>
  
  <pre class="lang-java prettyprint-override"><code>try {
      Blob image_vis = rs1.getBlob(10);
      InputStream x=image_vis.getBinaryStream();
      OutputStream out=new FileOutputStream(string_op);
      byte[] bytes = string_op.getBytes();
      String s=new String(bytes);
      System.out.println(+s);  //prints bytes for the string
      ImageIcon icon_cap = new ImageIcon(string_op);
      image_cap.setIcon(icon_cap);   //prints nothing to Jlabel
      //image_cap.setText(s);     //prints a path of a image
  }
  </code></pre>