Re: Problems with OracleAdapter

From: laila paganelli (laila.paganell..mail.com)
Date: Wed Mar 30 2005 - 05:35:57 EST

  • Next message: Andrus Adamchik: "Re: DataObject becomes hollow when passed through a tapestry DirectLink"

    I turn off the batching and it works!

    Thanks
    Laila

    On Thu, 24 Mar 2005 13:10:41 -0500 (EST), Andrus Adamchik
    <andru..bjectstyle.org> wrote:
    > Laila,
    >
    > I really don't recommend switching from OracleAdapter to generic
    > JdbcAdapter. Looking at your exception stack, it looks like a problem is
    > with batch updates. So just turn off the batching:
    >
    > OracleAdapter adapter = ... extract this from DataNode
    > adapter.setSupportsBatchUpdates(false);
    >
    > Andrus
    >
    >
    > > 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 : Wed Mar 30 2005 - 05:36:01 EST