It turns out this particular problem was being caused by 'DISTINCT' being set 
in the criteria.

Removing distinct solves my problems...

P 

-----Original Message-----
From: Nase, Paul R. [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 02, 2005 11:16 AM
To: '[email protected]'
Subject: Oracle9i Blob Field Access



I am having some strange issues with retrieving a blob field.

I am using an Oracle9i DB with the oci8(not thin) JDBC driver.  I am also at 
OJB 1.0.1.

There are two parts to this problem.
1)  When I go to access my object containing a blob field using 
getObjectByIdentity(), it fails the first time, but succeeds on subsequent 
calls.  If I restart the server - again it fails the first time - and success 
afterwards.
2)  When I go to search for any of these objects containing this blob field, it 
fails every time.

The failure exception is as follows:
org.apache.ojb.broker.PersistenceBrokerSQLException: java.sql.SQLException: 
ORA-00932: inconsistent datatypes: expected - got BLOB

        at java.lang.Throwable.<init>(Throwable.java)
        at 
org.apache.commons.lang.exception.NestableRuntimeException.<init>(NestableRuntimeException.java:111)
        at 
org.apache.ojb.broker.OJBRuntimeException.<init>(OJBRuntimeException.java:40)
        at 
org.apache.ojb.broker.PersistenceBrokerException.<init>(PersistenceBrokerException.java:69)
        at 
org.apache.ojb.broker.PersistenceBrokerSQLException.<init>(PersistenceBrokerSQLException.java:37)
        at 
org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeQuery(JdbcAccessImpl.java:318)
        at 
org.apache.ojb.broker.accesslayer.RsQueryObject.performQuery(RsQueryObject.java:74)
        at 
org.apache.ojb.broker.accesslayer.RsIterator.<init>(RsIterator.java:183)
        at 
org.apache.ojb.broker.core.RsIteratorFactoryImpl.createRsIterator(RsIteratorFactoryImpl.java:58)
        at 
org.apache.ojb.broker.core.PersistenceBrokerImpl.getRsIteratorFromQuery(PersistenceBrokerImpl.java:1808)
        at 
org.apache.ojb.broker.core.PersistenceBrokerImpl.getIteratorFromQuery(PersistenceBrokerImpl.java:1333)
        at 
org.apache.ojb.broker.core.PersistenceBrokerImpl.getIteratorByQuery(PersistenceBrokerImpl.java:1320)
        at 
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getIteratorByQuery(DelegatingPersistenceBroker.java:322)
        at 
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getIteratorByQuery(DelegatingPersistenceBroker.java:322)

Repository field descriptor:
      <field-descriptor
         name="exportFile"
         column="EXP_FILE"
         jdbc-type="BLOB"
      />

Class definition:
        protected byte[] exportFile;

I have changed this blob field to a CLOB field and it was successfully storing 
and retrieving up to 10 Meg of data...but alas I cannot use CLOB as the data I 
am wishing to store is binary information!

If someone could point me in the right direction, I would be immensely grateful!

Thanks much,

Paul

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to