title: Write Long Raw bmp file to Oracle Databse using Java
body: <p>I'm trying to save a bmp file to a long raw column in a legacy oracle database using java, but i does not work well. This is the code i used:</p>
  
  <pre><code>InputStream input2 = new ByteArrayInputStream(bytesArchivo);
  String sql = "UPDATE firma_legal SET " +
                       "      firma = ? " +
                       "WHERE cod_unicom = 1120";
  OraclePreparedStatement  stat =
                  (OraclePreparedStatement) connection.prepareStatement(sql);
  stat.setBinaryStream(1, input2, (int)archivo.length());
  stat.executeUpdate();
  input2.close();
  </code></pre>
  
  <p>The code execute well, but when i see in the database, it does not update the row that i want, instead, it put this string "BMF;".</p>
  
  <p><img src="https://i.stack.imgur.com/pdqdf.jpg" alt="Row updated"></p>
  
  <p>How can i do to insert this file into long raw column?</p>
  
  <p>Thanks for your help.</p>