RE: Problems with OracleAdapter

From: Cris Daniluk (cris.danilu..laraview.com)
Date: Thu Mar 24 2005 - 13:00:17 EST

  • Next message: Cris Daniluk: "RE: Problems with OracleAdapter"

    I would consider writing your own driver that extended the JdbcAdapter and
    added support for PkGeneration based on the way Oracle does it. Odds are
    none of the features specific to the OracleAdapter will really work with
    Oracle 7.x anyway, so I doubt you'll lose much.

    Though - I would be cautious. You say your read/writes are okay using
    JdbcAdapter, but I have a feeling that if you write more than 4k to the
    field, you will find it gets truncated.

    As another option, you could create an ExtendedType for your LONG fields and
    use the OracleAdapter, but override handling to be less bloblike.

    Cris

    > Hi Cris,
    >
    > I know LONG fields have been deprecated since long ago, but we are
    > still stuck with them as many or our applications are still developed
    > using WebObjects 4.5.1 (using Objective-C) and its Oracle Adaptor
    > links against a very old version of the OCI (around 7.3) that could
    > handle only LONG fields; no LOBs available thou.
    >
    > I'm using 9.0.2 JDBC drivers with Cayenne and when running my
    > application using JdbcAdapter read/write LONG operation is ok.
    > Do you think It is possible to use OracleAdapter?
    > If it is impossible, how I can customize PK generation using
    > a JdbcAdapter?
    >
    > Thanks
    > Laila
    >
    >
    >
    > On Wed, 23 Mar 2005 10:13:01 -0500, Cris Daniluk
    > <cris.danilu..laraview.com> wrote:
    > > 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 : Fri Mar 25 2005 - 09:59:23 EST