RE: Problems with OracleAdapter

From: Cris Daniluk (cris.danilu..laraview.com)
Date: Wed Mar 23 2005 - 10:13:01 EST

  • Next message: Fredrik Liden: "PK in Expression ok?"

    A most likely guess is that your Oracle JDBC driver doesn't support LONGs.
    LONGs are deprecated and should not be used anymore, so if you're using an
    old version of Oracle with a new version of the driver... Could be a
    problem.

    > Hi,
    >
    > I would like use an OracleAdapter in my application because I
    > want to customize PK generation.
    > If I create a dataNode with a DbAdapter
    > org.objectstyle.cayenne.dba.JdbcAdapter works very well, but
    > if I set DbAdapter
    > org.objectstyle.cayenne.dba.oracle.OracleAdapter an error occur.
    >
    > INFO 2005-03-23 14:28:04,854 *** error.
    > java.sql.SQLException: operation not allowed: streams type
    > cannot be used in batching
    > at
    > oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
    > at
    > oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
    > at
    > oracle.jdbc.driver.OraclePreparedStatement.addBatch(OraclePrep
    > aredStatement.java:3999)
    > at
    > org.objectstyle.cayenne.access.DataNode.runBatchUpdateAsBatch(
    > DataNode.java:535)
    > at
    > org.objectstyle.cayenne.dba.oracle.OracleDataNode.runBatchUpda
    > teAsBatch(OracleDataNode.java:355)
    > at
    > org.objectstyle.cayenne.access.DataNode.runBatchUpdate(DataNod
    > e.java:498)
    > at
    > org.objectstyle.cayenne.access.DataNode.performQueries(DataNod
    > e.java:353)
    > at
    > org.objectstyle.cayenne.access.ContextCommit.commit(ContextCom
    > mit.java:192)
    > at
    > org.objectstyle.cayenne.access.DataContext.commitChanges(DataC
    > ontext.java:1266)
    > at
    > org.objectstyle.cayenne.access.DataContext.commitChanges(DataC
    > ontext.java:1236)
    > [...]
    >
    > I'm using a simple ExtendedType implementation for Oracle
    > LONG fields (view also
    > http://www.objectstyle.org/cayenne/lists/cayenne-user/2005/01/
    > 0193.html)
    > with a method
    >
    > public void setJdbcObject( java.sql.PreparedStatement st,
    > java.lang.Object val,
    > int pos,
    > int type,
    > int precision) throws
    > java.lang.Exception {
    > if (val != null) {
    > com.extrapola.cayenne.oracle.LongType longType;
    > java.io.StringReader in;
    >
    > longType = (com.extrapola.cayenne.oracle.LongType)val;
    >
    > in = new java.io.StringReader(longType.string());
    > st.setCharacterStream(pos, in, longType.string().length());
    > } else {
    > super.setJdbcObject(st, val, pos, type, precision);
    > }
    > }
    >
    >
    > Some suggestion?
    >
    > Thanks
    > Laila
    >



    This archive was generated by hypermail 2.0.0 : Wed Mar 23 2005 - 10:13:03 EST