title: java.sql.SQLException: ORA-01461: can bind a LONG value only for insert into a LONG column
body: <p>I am using a simple interface (in jsf 1.2 and rich faces 3.3.2, Oracle 11g R1) to let user select picture with rich:fileUpload and save in a table.
  As a test, i created following table.</p>
  
  <pre><code>CREATE TABLE TEST
  (
   MIME_TYPE VARCHAR2 (1000),
   PHOTO BLOB,
   STUDENT_ID NUMBER NOT NULL
  )
  </code></pre>
  
  <p>code snippet to save the picture to BLOB field is as follows.</p>
  
  <pre><code>//......From the uploadFile Listener
  public void listener(UploadEvent event) throws Exception {
  ...      
  item = event.getUploadItem();
  ...
  StudentPhotoDAO dao = new StudentPhotoDAO();
  dao.storePhoto(item.getData(),item.getContentType(),studentId);
  ...
  }
  
  
  //......From the PhotoDAO ..........................
  
  
  public void storePhoto(byte data[],String mimeType, Long studentId){
  {
   ...
    ByteArrayInputStream bis=new ByteArrayInputStream(data);
    String query = "update  TEST set PHOTO = ? ,MIME_TYPE = ?  where STUDENT_ID=?";
    pstmt = conn.prepareStatement(query);
    pstmt.setAsciiStream(1,(InputStream)bis,data.length);
    pstmt.setString(2,mimeType.toString());
    pstmt.setLong(3,studentId);
    pstmt.executeUpdate();
   }
  </code></pre>
  
  <p>I get following error:</p>
  
  <pre><code>java.sql.SQLException: ORA-01461: can bind a LONG value only for insert into a LONG column
  </code></pre>
  
  <p>Where is the error in the code please.</p>
  
  <p>Thanks.</p>