2 Replies Latest reply: Aug 3, 2011 5:26 AM by 879923 RSS

    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
        • 1. Re: Porblems with the ORDImage object
          846966
          hey, It seems that i'm having the same problem and its the only thread i found trying to fix it.
          but unfortunately no replies so i'm trying to make it alive again...
          please help...
          any answer would be appreciated.
          • 2. Re: Porblems with the ORDImage object
            879923
            i have same problem...

            but, in my case....

            sql = "SELECT SEQ_DOC_ARTICLE.NEXTVAL FROM DUAL";
            ps3 = con2.prepareStatement(sql);
            rs3 = ps3.executeQuery();
            long ATCL_NO = 0;
            while(rs3.next()){
            ATCL_NO = rs.getLong(1);
            System.out.println("ATCL_NO : "+ATCL_NO);
            }

            this returns only '11'......ㅠ.ㅠ
            I don't know why~```