Results 1 to 1 of 1
  1. #1
    Join Date
    Dec 2004
    Posts
    3

    Unanswered: Oracle interMedia and OrdDoc problem

    Hello

    I'm using oracle 9i. I was trying to run a demo provided with Oracle 9i:

    First there is SQL code
    CREATE TABLE TDOC(n NUMBER, doc ORDSYS.ORDDOC);
    INSERT INTO TDOC VALUES(1, ORDSYS.ORDDoc.init());
    commit;

    Then there is java code:

    public void loadDataFromFile(OracleConnection con) {
    try {
    Statement s = con.createStatement();
    OracleResultSet rs = (OracleResultSet) s
    .executeQuery("select * from TDOC where n = 1 for update ");
    int index = 0;
    while (rs.next()) {
    index = rs.getInt(1);
    OrdDoc docObj = (OrdDoc) rs.getCustomDatum(2, OrdDoc
    .getFactory());

    docObj.loadDataFromFile(dirPath + "imgdemo.dat");
    String s1 = "update tdoc set doc = ? where n = " + index;
    OraclePreparedStatement stmt1 = (OraclePreparedStatement) con
    .prepareCall("update tdoc set doc = ? where n = "
    + index);

    stmt1.setCustomDatum(1, docObj);

    stmt1.executeUpdate();
    stmt1.close();
    }
    } catch (Exception e) {
    e.printStackTrace();
    }

    main() {

    OracleConnection con = null;
    con = getConnection();
    con.setAutoCommit(false); //to be able to perform select for update
    loadDataFromFile(con);
    con.commit();
    con.close();
    }

    - The problem is that after the program us run, the field doc is null in row with N=1!!! The same problem is if trying to load (with similar code) an image into OrdImage field in another table.
    - Another problem is that the method setCustomDatum(1, docObj). I came across the notice that it should be used setORAData(int a1, ORAData a2) but this method is not supported by OrdDoc class.

    Was anybody successfully using OrdDoc or OrdImage type with Oracle9i?

    Marek
    mail: mareknow-pbc(at)o2.pl
    Last edited by MarekNow; 12-07-04 at 07:50.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •