title: Prepare statement for byte [] in java
body: <p>I have one database table in which one column (declatationform) is of type "bytea"  i want to store images in this column so i have return one method which is </p>
  
  <pre><code>public void uploadRentProofDeclaration(final MultipartFile declarationForm,
          final int rentProofInfoId, int year) {
  
      String updateSql = "update plit_landlordinfo" + year
              + " set filename=?,declarationform=? where cid=?";
      getJdbcTemplate().execute(updateSql, new PreparedStatementCallback() {
          public Object doInPreparedStatement(
                  final PreparedStatement pSstatement) throws SQLException,
                  DataAccessException {
              pSstatement.setString(1, declarationForm.getOriginalFilename());
  
              try {
                  pSstatement.setBinaryStream(2, new ByteArrayInputStream(
                          declarationForm.getBytes()), declarationForm
                          .getBytes().length);
              } catch (IOException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
              }
              pSstatement.setInt(3, rentProofInfoId);
  
              pSstatement.execute();
              return null;
          }
      });
  }
  </code></pre>
  
  <p>Here what is happening is file name is getting save but byte [] is not save still that column is blank in my table and it is not giving any error can any one help me what is the problem</p>