2 Replies Latest reply on Aug 3, 2011 10:26 AM by 879923

    Porblems with the ORDImage object

    520454
      I'm actually having a problem in my Java code when inserting an image into the database.
      In fact, the jar files are set and the packages are inserted. When using the sql console the insertion works fine.
      I 'm using a simple Java code:
      try {
      ResultSet res = stmt.executeQuery("select s_o.nextval from dual");
      int id = 0;
      while (res.next())
      {
      id = res.getInt(1);
      }
      System.out.println(id);

      String rowInsertSQL = ("insert into o (obj) values (ordsys.ordimage.init())");
      stmt.execute(rowInsertSQL);

      // select the new ORDImage into a java proxy OrdImage object (imageProxy)
      String rowSelectSQL = "select obj from o where ido = "+id+" for update";
      OracleResultSet rset = (OracleResultSet)stmt.executeQuery(rowSelectSQL);
      rset.next();
      OrdImage imageProxy = (OrdImage)rset.getORAData("OBJ", OrdImage.getORADataFactory());
      rset.close();
      try {
      imageProxy.loadDataFromFile("x.jpg");
      imageProxy.setProperties();
      String updateSQL = "update o set obj=? where ido="+id;
      OraclePreparedStatement opstmt = (OraclePreparedStatement)conn.prepareStatement(updateSQL);
      opstmt.setORAData(1, imageProxy);
      opstmt.execute();
      opstmt.close();

      System.out.println("ok 2ata3 el tartar");
      } catch (IOException ex1) {
      ex1.printStackTrace();
      } catch (SQLException ex1) {
      ex1.printStackTrace();
      }
      }
      catch (SQLException ex) {
      ex.printStackTrace();
      }

      and the error i get is specified as follows :

      Exception in thread "main" java.lang.VerifyError: (class: oracle/ord/im/OrdImageBase, method: create signature: (Loracle/ord/im/OrdImageBase;Loracle/sql/Datum;I)Loracle/sql/CustomDatum;) Incompatible object argument for function call

      and it is related to the object OrdImage imageProxy = (OrdImage)rset .....

      Any help would be appreciated