title: How to convert Blob to String and String to Blob in java
body: <p>I'm trying to get string from BLOB datatype by using </p>
  
  <pre><code>Blob blob = rs.getBlob(cloumnName[i]);
  byte[] bdata = blob.getBytes(1, (int) blob.length());
  String s = new String(bdata);
  </code></pre>
  
  <p>It is working fine but when I'm going to convert <code>String</code> to <code>Blob</code> and trying to insert into database then nothing inserting into database. I've used below code for converting String to Blob:</p>
  
  <pre><code>String value = (s);
  byte[] buff = value.getBytes();
  Blob blob = new SerialBlob(buff);
  </code></pre>
  
  <p>Can anyone help me about to converting of <code>Blob</code> to <code>String</code> and <code>String</code> to <code>Blob</code> in Java?</p>