code: public static byte[] readBlob(Object blob, boolean close) throws SQLException {
          byte[] result = null;
          InputStream input = null;
  
          //input = blob.getBinaryStream();
          try {
              input = (InputStream) MappingUtils.invokeFunction(blob, "getBinaryStream", new Class[]{}, new Object[]{});
          } catch (MjdbcException ex) {
              throw new MjdbcSQLException(ex);
          }
  
          result = toByteArray(input);
  
          if (close == true) {
              TypeHandlerUtils.closeQuietly(input);
          }
  
          return result;
      }
docs: Transfers data from sql.Blob into byte[]
  
  @param blob  sql.Blob which would be read
  @param close informs if sql.Blob should be closed after a read
  @return array of bytes from sql.Blob
  @throws SQLException