Db2 blob ClassCastException

I get the following error when retrieving a Dealer object from DB2:
java.lang.ClassCastException: COM.ibm.db2.jdbc.net.DB2Blob
Dealer has a Profile object which is stored as a blob.
This is the DEALERX table definition:
CREATE TABLE DEALERX (JDOIDX BIGINT NOT NULL, JDOLOCKX INTEGER, JDOCLASSX
VARCHAR(255), ACCOUNTX BLOB(1M), EXTERNALIDX VARCHAR(255), IDX
VARCHAR(255),
PROFILEX BLOB(1M), PRIMARY KEY (JDOIDX));
Please note that I am able to successfully retrieve Dealer
objects with MYSQL.
DB2 server version is 7.2.3
I am using the net jdbc driver (COM.ibm.db2.jdbc.net.DB2Driver) supplied
by UBM with DB2.
Any hint?
Thank you.

Claudius,
What you posted is only a partial stack trace. Could you post the full
stack trace, including the nested exception(s)?
-Patrick
Patrick Linskey
SolarMetric Inc.

Similar Messages

  • [ JHeadstart ] Download DB2 BLOB with OrdDocDomain

    Hello,
    I have managed to import a pdf into a DB2 BLOB. In the entity (and view) i have java.sql.blob attribute to the DB2 BLOB column. Furthermore I have a OrdDocDomain attribute reading the blob in the entity for the JHeadstart integration (using the filedownload option).
    Application works fine, but i want to control the filename displayed when downloading the file. Also I want to inform the browser with the MIME type. I have used several properties on the OrdDocDomain but they don't seem to be of any effect on the download dialog.
    How can i control the MimeType en Filename when downloading the blob using the JHeadstart application definition/ADF?
    JHeadstart version: 10.1.3.0.97
    Kind Regards,
    Endy

    Endy,
    This is documented in the Developers Guide, chapter 3, section "Showing Properties Of Uploaded Files"
    Steven Davelaar,
    JHeadstart Team.

  • Oracle.sql.BLOB ClassCastException

    Hi everyone,
    I'm trying to put a serialized Java object into Oracle. I am following the example here: http://www.oracle.com/oramag/oracle/01-may/o31asktom.html
    Here is my code:
    String sql = "begin " +
          "insert into rdm_logs (datetime, id, machine, ip_addr, action_code, tablename, comments, " +
         "row_before, row_after)" +
          "values (sysdate, ?, ?, ?, ?, ?, ?, empty_blob(), empty_blob()) " +
          "return row_before into ?; " +
      "end;";
    CallableStatement stmt = connection.prepareCall(sql);
    stmt.setString(1, username);
    stmt.setString(2, machine);
    stmt.setString(3, ip);
    stmt.setString(4, action_code);
    stmt.setString(5, table);
    stmt.setString(6, comment);
    stmt.registerOutParameter(7, java.sql.Types.BLOB);               
    stmt.executeUpdate();               
    Object o = stmt.getBlob(7);
    // output class name here
    System.out.println(o.getClass().toString());
    // cast to oracle.sql.BLOB
    oracle.sql.BLOB blob = (BLOB) o;The system output is:
    class oracle.sql.BLOB
    java.lang.ClassCastException: oracle.sql.BLOB
    As you can see, the System.out gives oracle.sql.BLOB as the object class type, so why does it throw an exception when I cast it to be the same?
    Any help would be appreciated.

    As you can see, the System.out gives oracle.sql.BLOB as the object
    class type, so why does it throw an exception when I cast it to be the same?This can happen if the two BLOB classes have been loaded with two different unrelated class loaders. Even though the names of the classes are the same there are two separate classes.
    How to fix this depends... Somehow arrange the JDBC driver to be loaded by the system class loader before any other class loader has a chance to load it?

  • ClassCastException while inserting in oracle.sql.BLOB

    Hi,
    I have to insert a blob data in to database . I wrote the code . I'm having a ClassCastException problem in the line oracle.sql.BLOB blob = oracle.sql.BLOB.createTemporary(st.getConnection(), false,
    oracle.sql.BLOB.DURATION_CALL); while trying to store a BLOB value I'm using Oracle 9i. (JDBC classes12.jar).
    if I use the method with a dedicated database connection that specifies the driver as oracle.jdbc.driver.OracleDriver there is no problem .
    But when I use JBoss to run , I will get ClassCastException
    I imagine that somewhere in the code of this method there is a cast of the underlying connection leading to the ClassCastException when used in conjunction with the jboss datasource. The code to save the BLOB is as follows:
    String sql = " update test set code = ? where id = ?  ";
                 BLOB   newBlob = BLOB.createTemporary(dbcon, false, BLOB.DURATION_CALL);
                  newBlob.putBytes(1,data.getBytes());
                  stmt = dbcon.prepareStatement(newsql);
                 stmt.setBlob(1, newBlob);
                 stmt.setInt(2, Studid );
                 stmt.executeUpdate();
                 stmt.close();Can any one tell me how can I get this code to work with the datasource implementation.
    Thanks

    I think this could be a problem with the class loader . Take a look at this thread It should solve your problem.
    http://forum.java.sun.com/thread.jspa?forumID=48&threadID=788715

  • Insert Blob column in the client errors ClassCastException: oracle.sql.BLOB

    Hi,
    When I try to insert and commit a Blob column(picture) I am getting the following exception.
    Is there any jar I need to add or any other setup I need to do to accept the BLOB column in the olite client database.
    500 Internal Server Error
    javax.faces.FacesException: #{backing_XXPBWorkOrderResultsCreatePGBean.saveButton_action}: javax.faces.el.EvaluationException: java.lang.ClassCastException: oracle.sql.BLOB
         at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:78)
         at oracle.adf.view.faces.component.UIXCommand.broadcast(UIXCommand.java:211)
    Caused by: java.lang.ClassCastException: oracle.sql.BLOB
         at oracle.lite.poljdbc.LiteEmbPreparedStmt.setVal(Unknown Source)
         at oracle.lite.poljdbc.POLJDBCPreparedStatement.setObject(Unknown Source)
         at oracle.lite.poljdbc.POLJDBCPreparedStatement.setObject(Unknown Source)
         at oracle.lite.poljdbc.POLJDBCPreparedStatement.setObject(Unknown Source)
         at oracle.lite.web.JupPreparedStatement.setObject(Unknown Source)
         at oracle.jbo.server.BaseSQLBuilderImpl.bindUpdateStatement(BaseSQLBuilderImpl.java:1765)
         at oracle.jbo.server.EntityImpl.bindDMLStatement(EntityImpl.java:7345)
    With regareds,
    Kali.
    OSSI.

    Here are examples if inserting into a Blob from text, file, and retrieving a blob.
    Insert into a Blob (Text)
    import java.io.FileNotFoundException;
    import java.sql.Connection;
    import java.sql.Driver;
    import java.sql.DriverManager;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    public class InsertBlob {
        public static void main(String[] args) throws FileNotFoundException {
            Connection con = null;
            PreparedStatement stmt = null;
            ResultSet rs = null;
            String letterText = "some letter text";
            long id = 100;
            try {
                DriverManager.registerDriver((Driver)(Class.forName("oracle.lite.poljdbc.POLJDBCDriver").newInstance()));
                try {
                    con = DriverManager.getConnection("jdbc:polite:polite", "system", "manager");
                } catch (SQLException sqle) {
                    sqle.printStackTrace();
            } catch (Exception e) {
                e.printStackTrace();
            try {
                stmt = con.prepareStatement("INSERT INTO BLOB_TABLE (BLOB_ID, BLOB_DATA) VALUES (?, EMPTY_BLOB())");
                stmt.setLong(1, id);
                stmt.executeUpdate();
                stmt = con.prepareStatement("SELECT BLOB_DATA FROM BLOB_TABLE WHERE BLOB_ID = ? FOR UPDATE");
                stmt.setLong(1, id);
                rs = stmt.executeQuery();
                if (rs.next()) {
                    try {
                        oracle.lite.poljdbc.BLOB oliteBlob = null;
                        oliteBlob = ((oracle.lite.poljdbc.OracleResultSet) rs).getBLOB(1);
                        byte[] byteLetterText = letterText.getBytes();
                        oliteBlob.putBytes(1, byteLetterText);
                        con.commit();
                    } catch (ClassCastException e) {
                        e.printStackTrace();
                    } finally {
                        rs = null;
                        stmt = null;
                        con.rollback();
                        con = null;
            } catch (SQLException e) {
                e.printStackTrace();
    }Insert Into a Blob (File)
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.sql.Connection;
    import java.sql.Driver;
    import java.sql.DriverManager;
    import java.sql.PreparedStatement;
    import java.sql.SQLException;
    public class InsertBlobFile {
        public static void main(String[] args) throws FileNotFoundException {
            Connection con = null;
            PreparedStatement stmt = null;
            long id = 200;
            try {
                DriverManager.registerDriver((Driver)(Class.forName("oracle.lite.poljdbc.POLJDBCDriver").newInstance()));
                try {
                    con = DriverManager.getConnection("jdbc:polite:polite", "system", "manager");
                } catch (SQLException sqle) {
                    sqle.printStackTrace();
            } catch (Exception e) {
                e.printStackTrace();
            try {
                stmt = con.prepareStatement("INSERT INTO BLOB_TABLE (BLOB_ID, BLOB_DATA) VALUES (?, ?)");
                stmt.setLong(1, id);
                File fBlob = new File ( "C:\\BLOB_TEST_FILE.TXT" );
                FileInputStream is = new FileInputStream ( fBlob );
                stmt.setBinaryStream (2, is, (int) fBlob.length() );
                stmt.executeUpdate();
                con.commit();
            } catch (SQLException e) {
                e.printStackTrace();
    }Retrieve from Blob (Write to file)
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.sql.Blob;
    import java.sql.Connection;
    import java.sql.Driver;
    import java.sql.DriverManager;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    public class RetrieveBlob {
        final static int bBufLen = 32 * 1024;
        final static String outFile = "C:\\BLOB_OUTPUT_FILE.TXT";
        public static void main(String[] args) throws IOException {
            Connection con = null;
            PreparedStatement stmt = null;
            ResultSet rs = null;
            try {
                DriverManager.registerDriver((Driver)(Class.forName("oracle.lite.poljdbc.POLJDBCDriver").newInstance()));
                try {
                    con = DriverManager.getConnection("jdbc:polite:polite", "system", "manager");
                } catch (SQLException sqle) {
                    sqle.printStackTrace();
            } catch (Exception e) {
                e.printStackTrace();
            try {
                stmt = con.prepareStatement("SELECT * FROM BLOB_TABLE");
                rs = stmt.executeQuery();
                while(rs.next()) {
                    int id = rs.getInt(1);
                    Blob value = rs.getBlob(2);
                    System.out.println(id + " | " + value);
                    writeBlobToFile(value);
            } catch (SQLException e) {
                e.printStackTrace();
        public static long readFromBlob(Blob blob, OutputStream out)
          throws SQLException, IOException {
            InputStream in = blob.getBinaryStream();
            int length = -1;
            long read = 0;
            byte[] buf = new byte[bBufLen];
            while ((length = in.read(buf)) > 0) {
                out.write(buf, 0, length);
                read += length;
            in.close();
            return read;
        public static long writeBlobToFile(Blob blob)
          throws IOException, SQLException {
            long wrote = 0;
            OutputStream fwriter = new FileOutputStream(outFile);
            wrote = readFromBlob(blob, fwriter);
            fwriter.close();
            return wrote;
    }

  • ClassCastException in oracle.sql.BLOB.createTemporary

    Hi,
    I'm having a ClassCastException problem using the method oracle.sql.BLOB.createTemporary while trying to store a BLOB value (JDBC classes12.jar). The problem is quite clear - if I use the method with a dedicated database connection that specifies the driver as oracle.jdbc.driver.OracleDriver there is no problem - if I use it with an Orion datasource shipped with Oracle IAS10g it gives me a ClassCastException. I imagine that somewhere in the code of this method there is a cast of the underlying connection leading to the ClassCastException when used in conjunction with the Orion datasource. The code to save the BLOB is as follows:
    oracle.sql.BLOB blob = oracle.sql.BLOB.createTemporary(st.getConnection(), false,
    oracle.sql.BLOB.DURATION_SESSION);
    blob.open(BLOB.MODE_READWRITE);
    OutputStream out = blob.getBinaryOutputStream();
    try {
    out.write((byte[])value);
    out.flush();
    out.close();
    } catch (IOException e) {
    throw new SQLException("failed write to blob" + e.getMessage());
    blob.close();
    ((oracle.jdbc.OraclePreparedStatement)(st)).setBLOB(index, blob);
    My questions are:
    (1) is it possibile to save a BLOB type with a different version of Oracle JDBC without having to rely on the Oracle specific implementation of the JDBC interface (the cast of the PreparedStatement to oracle.jdbc.OraclePreparedStatement is quite ugly and not very portable!).
    (2) if not, then how can I get this code to work with the datasource implementation for Oracle IAS.
    thanks in advance for any help.
    Dara.

    If you are using OCI driver, you may check whether using thin driver would avoid ClassCastException.

  • ClassCastException w/ BLOB

    We are currently using v 2.5.2 and have run into a problem when attempting
    to insert a BLOB using WebLogic (via EJB). When I run a stand-alone test
    case, everything works as planned. The BLOB is inserted with no problems.
    However, if I change the test case to call an EJB deployed on WebLogic
    8.1 (which in turn calls the same functionality to insert the BLOB via
    KODO), a receive the following exception:
    NestedThrowablesStackTrace:
    java.lang.ClassCastException
    at
    com.solarmetric.kodo.impl.jdbc.ormapping.OracleBlobMapping.update(OracleBlobMapping.java:100)
    at
    com.solarmetric.kodo.impl.jdbc.ormapping.OracleBlobMapping.insert(OracleBlobMapping.java:73)
    at
    com.solarmetric.kodo.impl.jdbc.ormapping.ClassMapping.insert(ClassMapping.java:437)
    at
    com.solarmetric.kodo.impl.jdbc.runtime.JDBCStoreManager.flush(JDBCStoreManager.java:530)
    at
    com.solarmetric.kodo.runtime.PersistenceManagerImpl.flushInternal(PersistenceManagerImpl.java:697)
    at
    com.solarmetric.kodo.runtime.PersistenceManagerImpl.commit(PersistenceManagerImpl.java:422)
    at
    com.iits.sdb.app.facade.MaintainProducerRequestFacade.addProducerRequest(MaintainProducerRequestFacade.java:99)
    at
    com.iits.sdb.app.delegate.MaintainProducerRequestDelegate.addProducerRequest(MaintainProducerRequestDelegate.java:89)
    at
    com.iits.ejb.RequestProcessBean.persistRequest(RequestProcessBean.java:333)
    at
    com.iits.ejb.RequestProcessBean.prepareAddInitialAppointment(RequestProcessBean.java:125)
    at
    com.iits.ejb.RequestProcessEjb_pfomyb_EOImpl.prepareAddInitialAppointment(RequestProcessEjb_pfomyb_EOImpl.java:150)
    at
    com.iits.ejb.RequestProcessEjb_pfomyb_EOImpl_WLSkel.invoke(Unknown Source)
    at
    weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:466)
    at
    weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef.java:108)
    at
    weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:409)
    at
    weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:353)
    at
    weblogic.security.service.SecurityManager.runAs(SecurityManager.java:144)
    at
    weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:404)
    at
    weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:30)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
    Any help would be greatly appreciated.

    Marc,
    After doing some additional investigation, the following link provides
    more insight into why the error occurred.
    http://e-docs.bea.com/wls/docs70/jdbc/thirdparty.html#1045809
    It seems like adding a conditional cast to weblogic's wrapper class,
    weblogic.jdbc.vendor.oracle.OracleThinBlob, would fix the issue in
    OracleBlobMapping. Is there a recommended way for us to add this
    functionality, to enable us to still use Kodo for BLOB's in WebLogic?
    Thanks,
    Josh
    Josh Zook wrote:
    After trying your suggestion below, I still run into the same issue (see
    stack trace below). However, after looking at the generated SQL, it
    appears that Kodo is trying to INSERT the blob, rather than use
    EMPTY_BLOB() and then SELECT FOR UPDATE. I don't think upgrading is 3.0
    is an option for us at this time. Please let me know if you can think of
    anything else.
    Thanks,
    Josh
    java.sql.SQLException: Data size bigger than max size for this type: 4036
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
    at oracle.jdbc.ttc7.TTCItem.setArrayData(TTCItem.java:95)
    at
    oracle.jdbc.dbaccess.DBDataSetImpl.setBytesBindItem(DBDataSetImpl.java:2413)
    at
    oracle.jdbc.driver.OraclePreparedStatement.setItem(OraclePreparedStatement.java:1166)
    at
    oracle.jdbc.driver.OraclePreparedStatement.setBinaryStream(OraclePreparedStatement.java:2598)
    at
    weblogic.jdbc.wrapper.PreparedStatement.setBinaryStream(PreparedStatement.java:289)
    at
    com.iits.pulsar.jdo.OracleDictionary.blobToPreparedParameter(OracleDictionary.java:76)
    Marc Prud'hommeaux wrote:
    Josh-
    The problem is that the Oracle JDBC drivers require special handling for
    blobs over a certain size: they need to have Oracle-specific BLOB/CLOB
    classes. Unfortunately, when another DataSource wraps the oracle
    DataSource, there isn't much we can do.
    Kodo 3.0 has a better way of doing this that will probably work around
    your problem. If you don't want to upgrade to 3.0 RC 1, then you
    could try to subclass OracleDictionary with your own class that
    overrides AbstractDictionary.blobToPreparedParameter. I have read that
    some versions of the Oracle driver will handle a direct blob better if
    you call stmnt.setBinaryStream(index, new ByteArrayInputStram (bytes))
    the if you do stmnt.setObject(index, ob) (which is the default way we
    deal with this).
    Please let us know if you still have problems after trying this.
    In article <[email protected]>, Josh Zook wrote:
    Thanks for the help. Yes, we are using WebLogic datasource, so that is
    the root of the problem. My standalone test case was using Kodo intenal
    connection pooling. It looks like WebLogic datasource wraps the
    ResultSet
    and Blob in it's own classes (perhaps causing the cast exception?).
    I tried you advice and set isOracleJDBCDriver=false. I now get the
    exception listed below. Any suggestions would be appreciated.
    java.sql.SQLException: Data size bigger than max size for this type: 4009
    atoracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
    atoracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
    at oracle.jdbc.ttc7.TTCItem.setArrayData(TTCItem.java:95)
    at
    oracle.jdbc.dbaccess.DBDataSetImpl.setBytesBindItem(DBDataSetImpl.java:2413)
    at
    oracle.jdbc.driver.OraclePreparedStatement.setItem(OraclePreparedStatement.java:1166)
    at
    oracle.jdbc.driver.OraclePreparedStatement.setBytes(OraclePreparedStatement.java:2208)
    at
    oracle.jdbc.driver.OraclePreparedStatement.setObject(OraclePreparedStatement.java:3002)
    at
    oracle.jdbc.driver.OraclePreparedStatement.setObject(OraclePreparedStatement.java:3217)
    at
    weblogic.jdbc.wrapper.PreparedStatement.setObject(PreparedStatement.java:172)
    at
    com.solarmetric.kodo.impl.jdbc.schema.dict.AbstractDictionary.blobToPreparedParameter(AbstractDictionary.java:1110)
    at
    com.solarmetric.kodo.impl.jdbc.schema.dict.OracleDictionary.blobToPreparedParameter(OracleDictionary.java:203)
    at
    com.solarmetric.kodo.impl.jdbc.schema.dict.AbstractDictionary.toPreparedParameter(AbstractDictionary.java:840)
    at
    com.solarmetric.kodo.impl.jdbc.sql.SQLValue.applyParameter(SQLValue.java:129)
    at
    com.solarmetric.kodo.impl.jdbc.sql.SQLBuffer.setParameters(SQLBuffer.java:239)
    at
    com.solarmetric.kodo.impl.jdbc.sql.SQLBuffer.setParameters(SQLBuffer.java:222)
    at
    com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.prepareStatementInternal(SQLExecutionManagerImpl.java:753)
    at
    com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.executePreparedStatementNonBatch(SQLExecutionManagerImpl.java:445)
    at
    com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.executePreparedStatement(SQLExecutionManagerImpl.java:423)
    at
    com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.executeInternal(SQLExecutionManagerImpl.java:381)
    at
    com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.flush(SQLExecutionManagerImpl.java:255)
    at
    com.solarmetric.kodo.impl.jdbc.runtime.JDBCStoreManager.flush(JDBCStoreManager.java:554)
    at
    com.solarmetric.kodo.runtime.PersistenceManagerImpl.flushInternal(PersistenceManagerImpl.java:697)
    at
    com.solarmetric.kodo.runtime.PersistenceManagerImpl.commit(PersistenceManagerImpl.java:422)
    at
    com.iits.sdb.app.facade.MaintainProducerRequestFacade.addProducerRequest(MaintainProducerRequestFacade.java:106)
    >>>
    >>>
    Marc Prud'hommeaux wrote:
    Josh-
    Are you using Kodo's own DataSource in the Weblogic environment, or are
    you using a DataSource bound into WebLogic's JNDI? If the latter, then
    it may be that our special blob handling for Oracle is having problems
    with WebLogic's DataSource.
    One thing you might try to do is set the DictionaryProperties to have
    "isOracleJDBCDriver=false", which should prevent Kodo from using it's
    special Oracle driver behavior.
    In article <[email protected]>, Josh Zook wrote:
    We are currently using v 2.5.2 and have run into a problem when
    attempting
    to insert a BLOB using WebLogic (via EJB). When I run a stand-alonetest
    case, everything works as planned. The BLOB is inserted with noproblems.
    However, if I change the test case to call an EJB deployed on
    WebLogic
    8.1 (which in turn calls the same functionality to insert the BLOB via
    KODO), a receive the following exception:
    NestedThrowablesStackTrace:
    java.lang.ClassCastException
    at
    com.solarmetric.kodo.impl.jdbc.ormapping.OracleBlobMapping.update(OracleBlobMapping.java:100)
    at
    com.solarmetric.kodo.impl.jdbc.ormapping.OracleBlobMapping.insert(OracleBlobMapping.java:73)
    at
    com.solarmetric.kodo.impl.jdbc.ormapping.ClassMapping.insert(ClassMapping.java:437)
    at
    com.solarmetric.kodo.impl.jdbc.runtime.JDBCStoreManager.flush(JDBCStoreManager.java:530)
    at
    com.solarmetric.kodo.runtime.PersistenceManagerImpl.flushInternal(PersistenceManagerImpl.java:697)
    at
    com.solarmetric.kodo.runtime.PersistenceManagerImpl.commit(PersistenceManagerImpl.java:422)
    at
    com.iits.sdb.app.facade.MaintainProducerRequestFacade.addProducerRequest(MaintainProducerRequestFacade.java:99)
    at
    com.iits.sdb.app.delegate.MaintainProducerRequestDelegate.addProducerRequest(MaintainProducerRequestDelegate.java:89)
    at
    com.iits.ejb.RequestProcessBean.persistRequest(RequestProcessBean.java:333)
    at
    com.iits.ejb.RequestProcessBean.prepareAddInitialAppointment(RequestProcessBean.java:125)
    at
    com.iits.ejb.RequestProcessEjb_pfomyb_EOImpl.prepareAddInitialAppointment(RequestProcessEjb_pfomyb_EOImpl.java:150)
    at
    com.iits.ejb.RequestProcessEjb_pfomyb_EOImpl_WLSkel.invoke(UnknownSource)
    at
    weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:466)
    at
    weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef.java:108)
    at
    weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:409)
    at
    weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:353)
    at
    weblogic.security.service.SecurityManager.runAs(SecurityManager.java:144)
    at
    weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:404)
    at
    weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:30)
    atweblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
    Any help would be greatly appreciated.
    Marc Prud'hommeaux [email protected]
    SolarMetric Inc. http://www.solarmetric.com
    Marc Prud'hommeaux [email protected]
    SolarMetric Inc. http://www.solarmetric.com

  • ClassCastException reading blobs from MySQL

    Hi,
    When reading a blob (byte array) field from mysql I get a ClassCastException
    exception.
    Both using mysql 3.3.56 or 4.0.12 with jdbc driver 2.0.14 or 3.0.7, I get
    the same error.
    The same code works fine using other (sql-server, oracle) databases.
    Any ideas?
    configuration:
    kodo 2.4.3
    jdk 1.4.1-02
    jboss 3.0.4
    windows 2000
    2003-05-15 11:22:21,123 ERROR [STDERR] javax.jdo.JDOException:
    java.lang.ClassCastException
    NestedThrowables:
    java.lang.ClassCastException
    2003-05-15 11:22:21,123 ERROR [STDERR] at
    com.solarmetric.kodo.runtime.StateManagerImpl.loadField(StateManagerImpl.jav
    a:2043)
    2003-05-15 11:22:21,123 ERROR [STDERR] at
    com.solarmetric.kodo.runtime.StateManagerImpl.isLoaded(StateManagerImpl.java
    :720)
    2003-05-15 11:22:21,123 ERROR [STDERR] at
    dk.pine.enactment.ActionInstance.jdoGetinputParamBytes(ActionInstance.java)
    2003-05-15 11:22:21,123 ERROR [STDERR] at
    dk.pine.enactment.ActionInstance.getInputParams(ActionInstance.java:215)
    2003-05-15 11:22:21,123 ERROR [STDERR] at
    dk.pine.enactment.ejb.TransientServiceManager.findAction(TransientServiceMan
    ager.java:481)
    2003-05-15 11:22:21,123 ERROR [STDERR] at
    dk.pine.enactment.dispatch.DispatchMDB.onMessage(DispatchMDB.java:256)
    2003-05-15 11:22:21,123 ERROR [STDERR] at
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    2003-05-15 11:22:21,123 ERROR [STDERR] at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
    2003-05-15 11:22:21,123 ERROR [STDERR] at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
    ..java:25)
    2003-05-15 11:22:21,133 ERROR [STDERR] at
    java.lang.reflect.Method.invoke(Method.java:324)
    2003-05-15 11:22:21,133 ERROR [STDERR] at
    org.jboss.ejb.MessageDrivenContainer$ContainerInterceptor.invoke(MessageDriv
    enContainer.java:391)
    2003-05-15 11:22:21,133 ERROR [STDERR] at
    org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(Cach
    edConnectionInterceptor.java:186)
    2003-05-15 11:22:21,133 ERROR [STDERR] at
    org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor.invoke(MessageDrivenI
    nstanceInterceptor.java:88)
    2003-05-15 11:22:21,133 ERROR [STDERR] at
    org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor
    ..java:107)
    2003-05-15 11:22:21,133 ERROR [STDERR] at
    org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.
    java:237)
    2003-05-15 11:22:21,133 ERROR [STDERR] at
    org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:98)
    2003-05-15 11:22:21,133 ERROR [STDERR] at
    org.jboss.ejb.plugins.RunAsSecurityInterceptor.invoke(RunAsSecurityIntercept
    or.java:100)
    2003-05-15 11:22:21,133 ERROR [STDERR] at
    org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:208)
    2003-05-15 11:22:21,133 ERROR [STDERR] at
    org.jboss.ejb.MessageDrivenContainer.invoke(MessageDrivenContainer.java:302)
    2003-05-15 11:22:21,133 ERROR [STDERR] at
    org.jboss.ejb.plugins.jms.JMSContainerInvoker.invoke(JMSContainerInvoker.jav
    a:971)
    2003-05-15 11:22:21,133 ERROR [STDERR] at
    org.jboss.ejb.plugins.jms.JMSContainerInvoker$MessageListenerImpl.onMessage(
    JMSContainerInvoker.java:1047)
    2003-05-15 11:22:21,133 ERROR [STDERR] at
    org.jboss.jms.asf.StdServerSession.onMessage(StdServerSession.java:243)
    2003-05-15 11:22:21,133 ERROR [STDERR] at
    org.jboss.mq.SpyMessageConsumer.sessionConsumerProcessMessage(SpyMessageCons
    umer.java:637)
    2003-05-15 11:22:21,133 ERROR [STDERR] at
    org.jboss.mq.SpyMessageConsumer.addMessage(SpyMessageConsumer.java:443)
    2003-05-15 11:22:21,133 ERROR [STDERR] at
    org.jboss.mq.SpySession.run(SpySession.java:297)
    2003-05-15 11:22:21,133 ERROR [STDERR] at
    org.jboss.jms.asf.StdServerSession.run(StdServerSession.java:178)
    2003-05-15 11:22:21,133 ERROR [STDERR] at
    EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.ja
    va:732)
    2003-05-15 11:22:21,133 ERROR [STDERR] at
    java.lang.Thread.run(Thread.java:536)
    2003-05-15 11:22:21,133 ERROR [STDERR] NestedThrowablesStackTrace:
    2003-05-15 11:22:21,133 ERROR [STDERR] java.lang.ClassCastException
    2003-05-15 11:22:21,133 ERROR [STDERR] at
    dk.pine.enactment.ActionInstance.jdoReplaceField(ActionInstance.java)
    2003-05-15 11:22:21,133 ERROR [STDERR] at
    com.solarmetric.kodo.runtime.StateManagerImpl.replaceField(StateManagerImpl.
    java:2157)
    2003-05-15 11:22:21,133 ERROR [STDERR] at
    com.solarmetric.kodo.runtime.StateManagerImpl.storeObjectField(StateManagerI
    mpl.java:1617)
    2003-05-15 11:22:21,133 ERROR [STDERR] at
    com.solarmetric.kodo.impl.jdbc.ormapping.LobMapping.load(LobMapping.java:75)
    2003-05-15 11:22:21,143 ERROR [STDERR] at
    com.solarmetric.kodo.impl.jdbc.runtime.JDBCStoreManager.load(JDBCStoreManage
    r.java:375)
    2003-05-15 11:22:21,143 ERROR [STDERR] at
    com.solarmetric.kodo.runtime.StateManagerImpl.loadField(StateManagerImpl.jav
    a:2035)
    2003-05-15 11:22:21,143 ERROR [STDERR] at
    com.solarmetric.kodo.runtime.StateManagerImpl.isLoaded(StateManagerImpl.java
    :720)
    2003-05-15 11:22:21,143 ERROR [STDERR] at
    dk.pine.enactment.ActionInstance.jdoGetinputParamBytes(ActionInstance.java)
    2003-05-15 11:22:21,143 ERROR [STDERR] at
    dk.pine.enactment.ActionInstance.getInputParams(ActionInstance.java:215)
    2003-05-15 11:22:21,143 ERROR [STDERR] at
    dk.pine.enactment.ejb.TransientServiceManager.findAction(TransientServiceMan
    ager.java:481)
    2003-05-15 11:22:21,143 ERROR [STDERR] at
    dk.pine.enactment.dispatch.DispatchMDB.onMessage(DispatchMDB.java:256)
    2003-05-15 11:22:21,143 ERROR [STDERR] at
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    2003-05-15 11:22:21,143 ERROR [STDERR] at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
    2003-05-15 11:22:21,143 ERROR [STDERR] at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
    ..java:25)
    2003-05-15 11:22:21,143 ERROR [STDERR] at
    java.lang.reflect.Method.invoke(Method.java:324)
    2003-05-15 11:22:21,143 ERROR [STDERR] at
    org.jboss.ejb.MessageDrivenContainer$ContainerInterceptor.invoke(MessageDriv
    enContainer.java:391)
    2003-05-15 11:22:21,143 ERROR [STDERR] at
    org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(Cach
    edConnectionInterceptor.java:186)
    2003-05-15 11:22:21,143 ERROR [STDERR] at
    org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor.invoke(MessageDrivenI
    nstanceInterceptor.java:88)
    2003-05-15 11:22:21,143 ERROR [STDERR] at
    org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor
    ..java:107)
    2003-05-15 11:22:21,143 ERROR [STDERR] at
    org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.
    java:237)
    2003-05-15 11:22:21,143 ERROR [STDERR] at
    org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:98)
    2003-05-15 11:22:21,143 ERROR [STDERR] at
    org.jboss.ejb.plugins.RunAsSecurityInterceptor.invoke(RunAsSecurityIntercept
    or.java:100)
    2003-05-15 11:22:21,143 ERROR [STDERR] at
    org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:208)
    2003-05-15 11:22:21,143 ERROR [STDERR] at
    org.jboss.ejb.MessageDrivenContainer.invoke(MessageDrivenContainer.java:302)
    2003-05-15 11:22:21,143 ERROR [STDERR] at
    org.jboss.ejb.plugins.jms.JMSContainerInvoker.invoke(JMSContainerInvoker.jav
    a:971)
    2003-05-15 11:22:21,143 ERROR [STDERR] at
    org.jboss.ejb.plugins.jms.JMSContainerInvoker$MessageListenerImpl.onMessage(
    JMSContainerInvoker.java:1047)
    2003-05-15 11:22:21,143 ERROR [STDERR] at
    org.jboss.jms.asf.StdServerSession.onMessage(StdServerSession.java:243)
    2003-05-15 11:22:21,143 ERROR [STDERR] at
    org.jboss.mq.SpyMessageConsumer.sessionConsumerProcessMessage(SpyMessageCons
    umer.java:637)
    2003-05-15 11:22:21,143 ERROR [STDERR] at
    org.jboss.mq.SpyMessageConsumer.addMessage(SpyMessageConsumer.java:443)
    2003-05-15 11:22:21,143 ERROR [STDERR] at
    org.jboss.mq.SpySession.run(SpySession.java:297)
    2003-05-15 11:22:21,143 ERROR [STDERR] at
    org.jboss.jms.asf.StdServerSession.run(StdServerSession.java:178)
    2003-05-15 11:22:21,143 ERROR [STDERR] at
    EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.ja
    va:732)
    2003-05-15 11:22:21,143 ERROR [STDERR] at
    java.lang.Thread.run(Thread.java:536)

    Jesper-
    Strange. What is the type of the field? Is it a byte array? There are
    some special workarounds in the MySQLDictionary class to get around bugs
    in the MySQL JDBC driver, that might be conflicting with your field
    type.
    In article <[email protected]>, Jesper Ladegaard wrote:
    Hi,
    When reading a blob (byte array) field from mysql I get a ClassCastException
    exception.
    Both using mysql 3.3.56 or 4.0.12 with jdbc driver 2.0.14 or 3.0.7, I get
    the same error.
    The same code works fine using other (sql-server, oracle) databases.
    Any ideas?
    configuration:
    kodo 2.4.3
    jdk 1.4.1-02
    jboss 3.0.4
    windows 2000
    2003-05-15 11:22:21,123 ERROR [STDERR] javax.jdo.JDOException:
    java.lang.ClassCastException
    NestedThrowables:
    java.lang.ClassCastException
    2003-05-15 11:22:21,123 ERROR [STDERR] at
    com.solarmetric.kodo.runtime.StateManagerImpl.loadField(StateManagerImpl.jav
    a:2043)
    2003-05-15 11:22:21,123 ERROR [STDERR] at
    com.solarmetric.kodo.runtime.StateManagerImpl.isLoaded(StateManagerImpl.java
    :720)
    2003-05-15 11:22:21,123 ERROR [STDERR] at
    dk.pine.enactment.ActionInstance.jdoGetinputParamBytes(ActionInstance.java)
    2003-05-15 11:22:21,123 ERROR [STDERR] at
    dk.pine.enactment.ActionInstance.getInputParams(ActionInstance.java:215)
    2003-05-15 11:22:21,123 ERROR [STDERR] at
    dk.pine.enactment.ejb.TransientServiceManager.findAction(TransientServiceMan
    ager.java:481)
    2003-05-15 11:22:21,123 ERROR [STDERR] at
    dk.pine.enactment.dispatch.DispatchMDB.onMessage(DispatchMDB.java:256)
    2003-05-15 11:22:21,123 ERROR [STDERR] at
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    2003-05-15 11:22:21,123 ERROR [STDERR] at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
    2003-05-15 11:22:21,123 ERROR [STDERR] at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
    .java:25)
    2003-05-15 11:22:21,133 ERROR [STDERR] at
    java.lang.reflect.Method.invoke(Method.java:324)
    2003-05-15 11:22:21,133 ERROR [STDERR] at
    org.jboss.ejb.MessageDrivenContainer$ContainerInterceptor.invoke(MessageDriv
    enContainer.java:391)
    2003-05-15 11:22:21,133 ERROR [STDERR] at
    org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(Cach
    edConnectionInterceptor.java:186)
    2003-05-15 11:22:21,133 ERROR [STDERR] at
    org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor.invoke(MessageDrivenI
    nstanceInterceptor.java:88)
    2003-05-15 11:22:21,133 ERROR [STDERR] at
    org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor
    .java:107)
    2003-05-15 11:22:21,133 ERROR [STDERR] at
    org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.
    java:237)
    2003-05-15 11:22:21,133 ERROR [STDERR] at
    org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:98)
    2003-05-15 11:22:21,133 ERROR [STDERR] at
    org.jboss.ejb.plugins.RunAsSecurityInterceptor.invoke(RunAsSecurityIntercept
    or.java:100)
    2003-05-15 11:22:21,133 ERROR [STDERR] at
    org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:208)
    2003-05-15 11:22:21,133 ERROR [STDERR] at
    org.jboss.ejb.MessageDrivenContainer.invoke(MessageDrivenContainer.java:302)
    2003-05-15 11:22:21,133 ERROR [STDERR] at
    org.jboss.ejb.plugins.jms.JMSContainerInvoker.invoke(JMSContainerInvoker.jav
    a:971)
    2003-05-15 11:22:21,133 ERROR [STDERR] at
    org.jboss.ejb.plugins.jms.JMSContainerInvoker$MessageListenerImpl.onMessage(
    JMSContainerInvoker.java:1047)
    2003-05-15 11:22:21,133 ERROR [STDERR] at
    org.jboss.jms.asf.StdServerSession.onMessage(StdServerSession.java:243)
    2003-05-15 11:22:21,133 ERROR [STDERR] at
    org.jboss.mq.SpyMessageConsumer.sessionConsumerProcessMessage(SpyMessageCons
    umer.java:637)
    2003-05-15 11:22:21,133 ERROR [STDERR] at
    org.jboss.mq.SpyMessageConsumer.addMessage(SpyMessageConsumer.java:443)
    2003-05-15 11:22:21,133 ERROR [STDERR] at
    org.jboss.mq.SpySession.run(SpySession.java:297)
    2003-05-15 11:22:21,133 ERROR [STDERR] at
    org.jboss.jms.asf.StdServerSession.run(StdServerSession.java:178)
    2003-05-15 11:22:21,133 ERROR [STDERR] at
    EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.ja
    va:732)
    2003-05-15 11:22:21,133 ERROR [STDERR] at
    java.lang.Thread.run(Thread.java:536)
    2003-05-15 11:22:21,133 ERROR [STDERR] NestedThrowablesStackTrace:
    2003-05-15 11:22:21,133 ERROR [STDERR] java.lang.ClassCastException
    2003-05-15 11:22:21,133 ERROR [STDERR] at
    dk.pine.enactment.ActionInstance.jdoReplaceField(ActionInstance.java)
    2003-05-15 11:22:21,133 ERROR [STDERR] at
    com.solarmetric.kodo.runtime.StateManagerImpl.replaceField(StateManagerImpl.
    java:2157)
    2003-05-15 11:22:21,133 ERROR [STDERR] at
    com.solarmetric.kodo.runtime.StateManagerImpl.storeObjectField(StateManagerI
    mpl.java:1617)
    2003-05-15 11:22:21,133 ERROR [STDERR] at
    com.solarmetric.kodo.impl.jdbc.ormapping.LobMapping.load(LobMapping.java:75)
    2003-05-15 11:22:21,143 ERROR [STDERR] at
    com.solarmetric.kodo.impl.jdbc.runtime.JDBCStoreManager.load(JDBCStoreManage
    r.java:375)
    2003-05-15 11:22:21,143 ERROR [STDERR] at
    com.solarmetric.kodo.runtime.StateManagerImpl.loadField(StateManagerImpl.jav
    a:2035)
    2003-05-15 11:22:21,143 ERROR [STDERR] at
    com.solarmetric.kodo.runtime.StateManagerImpl.isLoaded(StateManagerImpl.java
    :720)
    2003-05-15 11:22:21,143 ERROR [STDERR] at
    dk.pine.enactment.ActionInstance.jdoGetinputParamBytes(ActionInstance.java)
    2003-05-15 11:22:21,143 ERROR [STDERR] at
    dk.pine.enactment.ActionInstance.getInputParams(ActionInstance.java:215)
    2003-05-15 11:22:21,143 ERROR [STDERR] at
    dk.pine.enactment.ejb.TransientServiceManager.findAction(TransientServiceMan
    ager.java:481)
    2003-05-15 11:22:21,143 ERROR [STDERR] at
    dk.pine.enactment.dispatch.DispatchMDB.onMessage(DispatchMDB.java:256)
    2003-05-15 11:22:21,143 ERROR [STDERR] at
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    2003-05-15 11:22:21,143 ERROR [STDERR] at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
    2003-05-15 11:22:21,143 ERROR [STDERR] at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
    .java:25)
    2003-05-15 11:22:21,143 ERROR [STDERR] at
    java.lang.reflect.Method.invoke(Method.java:324)
    2003-05-15 11:22:21,143 ERROR [STDERR] at
    org.jboss.ejb.MessageDrivenContainer$ContainerInterceptor.invoke(MessageDriv
    enContainer.java:391)
    2003-05-15 11:22:21,143 ERROR [STDERR] at
    org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(Cach
    edConnectionInterceptor.java:186)
    2003-05-15 11:22:21,143 ERROR [STDERR] at
    org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor.invoke(MessageDrivenI
    nstanceInterceptor.java:88)
    2003-05-15 11:22:21,143 ERROR [STDERR] at
    org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor
    .java:107)
    2003-05-15 11:22:21,143 ERROR [STDERR] at
    org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.
    java:237)
    2003-05-15 11:22:21,143 ERROR [STDERR] at
    org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:98)
    2003-05-15 11:22:21,143 ERROR [STDERR] at
    org.jboss.ejb.plugins.RunAsSecurityInterceptor.invoke(RunAsSecurityIntercept
    or.java:100)
    2003-05-15 11:22:21,143 ERROR [STDERR] at
    org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:208)
    2003-05-15 11:22:21,143 ERROR [STDERR] at
    org.jboss.ejb.MessageDrivenContainer.invoke(MessageDrivenContainer.java:302)
    2003-05-15 11:22:21,143 ERROR [STDERR] at
    org.jboss.ejb.plugins.jms.JMSContainerInvoker.invoke(JMSContainerInvoker.jav
    a:971)
    2003-05-15 11:22:21,143 ERROR [STDERR] at
    org.jboss.ejb.plugins.jms.JMSContainerInvoker$MessageListenerImpl.onMessage(
    JMSContainerInvoker.java:1047)
    2003-05-15 11:22:21,143 ERROR [STDERR] at
    org.jboss.jms.asf.StdServerSession.onMessage(StdServerSession.java:243)
    2003-05-15 11:22:21,143 ERROR [STDERR] at
    org.jboss.mq.SpyMessageConsumer.sessionConsumerProcessMessage(SpyMessageCons
    umer.java:637)
    2003-05-15 11:22:21,143 ERROR [STDERR] at
    org.jboss.mq.SpyMessageConsumer.addMessage(SpyMessageConsumer.java:443)
    2003-05-15 11:22:21,143 ERROR [STDERR] at
    org.jboss.mq.SpySession.run(SpySession.java:297)
    2003-05-15 11:22:21,143 ERROR [STDERR] at
    org.jboss.jms.asf.StdServerSession.run(StdServerSession.java:178)
    2003-05-15 11:22:21,143 ERROR [STDERR] at
    EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.ja
    va:732)
    2003-05-15 11:22:21,143 ERROR [STDERR] at
    java.lang.Thread.run(Thread.java:536)
    Marc Prud'hommeaux [email protected]
    SolarMetric Inc. http://www.solarmetric.com

  • Cfquery of MVS DB2 table containing BLOB Column

    Using ColdFusion MX 7. Able to convert the BLOB into a string
    when the data source is in UDB (Our development Database) however
    when the data source changes to MVS DB2 (Staging and Production
    Databases) the template no longer renders the data to the screen.
    code snippet from template:
    <cfoutput>
    <cfquery name="acct_selector"
    datasource="#request.ds#">
    SELECT DISTINCT * from dbo.Account
    where cf_token = '#cftoken#' and cf_pid = '#cfid#' and
    account_system!='I'
    order by account_num
    </cfquery>
    <cfset acctname=arraynew(1)>
    <cfset acctnumb=arraynew(1)>
    <cfset i=1>
    <cfloop query="acct_selector">
    <cfset acctname
    =account_name>
    <cfset acctnumb=account_num>
    <cfset i=i+1>
    </cfloop>
    <cfset
    rpdt1=dateformat(sDate,"yyyy-mm-dd")&"-00.00.00.000000">
    <cfset
    rpdt2=dateformat(sDate,"yyyy-mm-dd")&"-23.59.59.999999">
    <cfquery name="reflexReport"
    datasource="#request.db2#">
    select
    reflex_rpt_id,account_num,report_tmstp,sequence_num,fk_report_typ,report_txt
    from #request.db2qlfr#.gzb005_reflex_rpt
    where (<cfloop
    query="acct_selector">account_num='#account_num#' or
    </cfloop> account_num='0')
    and report_tmstp>='#rpdt1#' and
    report_tmstp<='#rpdt2#'
    </cfquery>
    </cfoutput>
    <cfif reflexReport.recordcount gt 0>
    ... (report headers built here) ....
    <cfoutput query="reflexReport">
    <cfset rpdata=tostring(report_txt)>
    I know there are rows being selected into the cursor because
    the headers are displaying on the browser page. If no rows are
    selected the process pops up an alert window tells the user there
    is no report data for the date selected.

    Well, I'm not familiar with DB2, but I've done a little
    research and from what I've found is that to resolve the problem
    you must do a rebind on the database. This typically happens if a
    Fixpack was applied. More information about rebinding bind files
    can be found in the Fixpakreadme.txt
    I hope this is applicable and does the trick for you.

  • Getting ClassCastException when accessing Blob object

    I am using weblogic 5.1 with service pack 10.
    I need to query pdf data stored in a blob field in Oracle
    8.1.6 server. The native code c:\weblogic\bin\oci816_8
    is part of the path. When I query the database with
    Oracle 8 client, I can get data.
    driver: weblogic.jdbc20.oci.Driver
    url: jdbc20:weblogic:oracle:mydb
    What I have done is to get the blob object with:
    Blob blob = rs.getBlob(5);
    long len = blob.length();
    But when I call the blob.length();
    I got the a ClassCastException. I really appreicate
    your comment.
    The exception message is:
    ====================================================
    java.lang.ClassCastException: java.lang.String
    at weblogic.jdbc20.oci.Blob.length(Blob.java:75)
    at com.agf.profile.ProfileServlet.doProcess(ProfileServlet.java:126)
    at com.agf.profile.ProfileServlet.doGet(ProfileServlet.java:37)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletSt
    pl.java:120)
    at weblogic.servlet.internal.ServletContextImpl.invokeServlet(Servle
    textImpl.java:922)
    at weblogic.servlet.internal.ServletContextImpl.invokeServlet(Servle
    textImpl.java:886)
    at weblogic.servlet.internal.ServletContextManager.invokeServlet(Ser
    ContextManager.java:269)
    at weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP
    a:380)
    at weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:129)
    ====================================================
    Thanks,
    Jian

    hi jian,
    it seems you are trying to access a column as a blob type when the data in
    that column is not blob.
    Make sure that your column number 5 is defined as Blob in the database.
    I tried the following code and it worked fine for me.
    Blob b=rs.getBlob("data");
    long l=b.length();
    byte bt[]=b.getBytes(1,(int)b.length());
    File f=new
    File("d:\\bea\\wlserver6.1\\config\\jdbcdomain\\applications\\defaultwebapp\
    \blob_new.pdf");
    FileOutputStream fos=new FileOutputStream(f);
    fos.write(bt);
    fos.close();
    It was able to create the file blob_new.pdf
    But when I tried the following code it gave me the same exception as you are
    getting
    Blob bb=rs.getBlob("id");
    long ll=bb.length();
    Where id is a column in the database of varchar type
    I am using the following settings
    driver: weblogic.jdbc.oci.Driver
    url: jdbc:weblogic:oracle
    i am using wl 6.1 and oracle 8
    Hope this helps you.
    johnny
    "jian zhang" <[email protected]> wrote in message
    news:[email protected]...
    >
    I am using weblogic 5.1 with service pack 10.
    I need to query pdf data stored in a blob field in Oracle
    8.1.6 server. The native code c:\weblogic\bin\oci816_8
    is part of the path. When I query the database with
    Oracle 8 client, I can get data.
    driver: weblogic.jdbc20.oci.Driver
    url: jdbc20:weblogic:oracle:mydb
    What I have done is to get the blob object with:
    Blob blob = rs.getBlob(5);
    long len = blob.length();
    But when I call the blob.length();
    I got the a ClassCastException. I really appreicate
    your comment.
    The exception message is:
    ====================================================
    java.lang.ClassCastException: java.lang.String
    at weblogic.jdbc20.oci.Blob.length(Blob.java:75)
    atcom.agf.profile.ProfileServlet.doProcess(ProfileServlet.java:126)
    at com.agf.profile.ProfileServlet.doGet(ProfileServlet.java:37)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
    atweblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletSt
    pl.java:120)
    atweblogic.servlet.internal.ServletContextImpl.invokeServlet(Servle
    textImpl.java:922)
    atweblogic.servlet.internal.ServletContextImpl.invokeServlet(Servle
    textImpl.java:886)
    atweblogic.servlet.internal.ServletContextManager.invokeServlet(Ser
    ContextManager.java:269)
    atweblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP
    a:380)
    atweblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:
    >
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:129)
    ====================================================
    Thanks,
    Jian

  • Db2 v8 and jdbc2 driver and Blob

    Two questions:
    1; I am running ibm db2 v8.1 Universal database.
    What jdbc i shipped with that on, is it jdbc2 or jdbc1, i cant find any usejdbc2 file, that you hade to run in version 7.
    Is the jdbc enabled at the start of the database?
    2; Do i have to use a prepareStatement to insert a Blob to the database?
    Best regards,
    Anders

    1. The db2 version 8.0 doesn't work with jdbc1. it is already shipped with jdbc2.
    so u don't have to run any batches as u had to do in db2 version 7.x
    2. I tried inserting a BLOB object into the database using JDBC without prepardstatement, but i faild. Trying with prepareStatement, it worked successfully.

  • Weblogic 9.2 Oracle Thin Driver and BLOB/CLoB ClassCastExceptions

    Hi,
    I think I may be about to ask a question that has been asked many times but I'm just trying to find the definitive best approach, if any to solve this problem.
    I'm working with Weblogic 9.2 on Windows. I have a couple of JDBC Oracle DataSources configured for container connection pooling and the driver that I'm using is the "Oracle's Driver (Thin) Versions 9.0.1,9.2.0,10". When retrieving a Blob from the DB we're calling
    oracle.sql.BLOB.blob = (oracle.sql.BLOB)(rs.getBlob(..))
    This results in a java.lang.ClassCastException: weblogic.jdbc.wrapper.Blob_oracle_sql_BLOB
    The same also occurs for Clobs.
    I found a link to an article written in 2003 (http://forums.bea.com/bea/message.jspa?messageID=200019959&tstart=0) that suggests writing your own OracleConnection wrapper class.
    I'm just wondering does anybody know if BEA have done anything to fix this problem, we're now on Weblogic 9.2 and this issue is still occuring. I'd rather not go down the route of writing additional code just so we can tell our customers that they can run on Weblogic (when they can successfully already run on Websphere and Tomcat).
    Thanks,
    Aoife

    For anyone who was wondering I managed to get this working though I do unfortunatley have to place a weblogic specific class in to my code :-(
    Used information provided at: http://support.bea.com/application_content/product_portlets/support_patterns/wls/CLOBBLOBDataTypeHandlingIssuesPattern.html#Recommended_programming_techniques
    Regards,
    Aoife

  • BLOBs in DB2 using DataDirect Driver

    I am using DataDirect JDBC Type-4 driver to connect to DB2. I have requirement to store large serialized java
    objects. For that initially I used BLOB type but when I call
    PreparedStatement.setBinarystream(colNo, inputStream, SerObjLength)
    I get an error saying: VALUE OF INPUT HOST VARIABLE NUM {0} NOT USED; WRONG DATA TYPE.
    As per DataDirect, they don't support BLOBs because DRDA restrictions(??). So I tried with CLOB. Now inserting
    is fine but when I retirve data using ObjectInputStream.readObject() I get error: java.io.InvalidClassException:
    java.util.Properties; Local class not compatible: stream classdesc serialVersionUID=4112578634029874751
    local class serialVersionUID=4112578634029874840.
    Now my question is, can we use CLOB for storing serialized
    objects? If not, what data type I can use for this to work or what are the other solutions.
    Any help on this is highly appreciated!!
    thanks in advance,
    dw

    i have the same problem. when i try to insert a binary on a blob colum says:
    "LOB col cannnot be selected by DRDA "
    (?????? help!). what does it means ?
    when i used other drivers (hit db2) tell the same message. what is the problem with db2?? anyone ?
    anyone has a example that insert a blob in a blob colum with sucess in db2 ??
    thanks

  • FindBy returning collection .. classcastException

    The following findBy returning a collection fails with exception below.
    The database is DB2 and the table columns are
    PERSON_ID, BIGINT
    PERSON_REGION_ID,INTEGER
    PEOPLE_DOCUMENT_SEQ,BIGINT
    LOB_ID,INTEGER
    DOCUMENT_TYPE_ID,INTEGER
    APPLICATION_ID,INTEGER
    PEOPLE_DOCUMENT_NAME,VARCHAR
    DOCUMENT_SIZE,BIGINT
    OWNER_ID,VARCHAR
    PATH_DESC,VARCHAR
    LAST_INDEXED_DATE,TIMESTAMP
    DOCUMENT_DATE,TIMESTAMP
    DOCUMENT_OBJECT,BLOB
    COMMENT_TXT,VARCHAR
    CREATED_BY,VARCHAR
    CREATED_DATE,TIMESTAMP
    MODIFIED_BY,VARCHAR
    MODIFIED_DATE,TIMESTAMP
    The mapping for BLOB is Direct to Field
    [TopLink Debug]: 2006.08.02 09:23:57.683--ServerSession(3333417)--Execute query ReadObjectQuery(com.rhii.mjplus.fo.peopledoc.beans.PeopleDocumentEntityBean)
    [TopLink]: 2006.08.02 09:23:57.691--ServerSession(3333417)--SELECT MODIFIED_DATE, OWNER_ID, COMMENT_TXT, APPLICATION_ID, CREATED_DATE, DOCUMENT_SIZE, PEOPLE_DOCUMENT_NAME, DOCUMENT_TYPE_ID, DOCUMENT_OBJECT, LOB_ID, DOCUMENT_DATE, PEOPLE_DOCUMENT_SEQ, CREATED_BY, PERSON_ID, MODIFIED_BY, PERSON_REGION_ID FROM PEOPLE_DOCUMENT WHERE ((PERSON_ID = ?) AND (PERSON_REGION_ID = ?))
    bind => [200970559, 3]
    [TopLink Debug]: 2006.08.02 09:23:57.691--ServerSession(3333417)--reconnecting to external connection pool
    [TopLink Debug]: executeFinder - finder execution results: com.rhii.mjplus.fo.peopledoc.beans.PeopleDocument_s9uc7t__TopLink_CMP_2_0@8caa63
    [TopLink Debug]: executeFinder return
    <2006-08-02 09:23:57,799> ERROR com.rhii.mjplus.common.exceptions.ExInterpreter - The actual Exception is : javax.transaction.TransactionRolledbackException: : java.lang.ClassCastException
    at oracle.toplink.internal.ejb.cmp.wls.CollectionFactory.createCollectionFor(CollectionFactory.java:55) at oracle.toplink.internal.ejb.cmp.wls.WlsBeanManager.collectionFinder(WlsBeanManager.java:208)
    at weblogic.ejb20.internal.EntityEJBHome.finder(EntityEJBHome.java:560)
    at com.rhii.mjplus.fo.peopledoc.beans.PeopleDocument_s9uc7t_HomeImpl.findByPersonId(PeopleDocument_s9uc7t_HomeImpl.java:152)
    at com.rhii.mjplus.fo.people.beans.PeopleGetManagerBean.getPeopleDocsDOs(Unknown Source)
    at com.rhii.mjplus.fo.people.beans.PeopleGetManager_cm1p2c_EOImpl.getPeopleDocsDOs(PeopleGetManager_cm1p2c_EOImpl.java:964)
    at com.rhii.mjplus.fo.common.FOPeopleStateHandler.getValue(Unknown Source)
    at com.rhii.mjplus.common.sessionMgmt.MjPlusStateHandler.getValue(Unknown Source)
    at com.rhii.mjplus.common.sessionMgmt.MjPlusStateHandler.getValue(Unknown Source)
    at com.rhii.mjplus.fo.people.controller.People_Docs_Servlet.doGet(Unknown Source)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    Appreciate any help.

    I have made this a readALL Query and hope this will fix it :)
    Thanks anyway !

  • How can i read a stored picture in oracle Long Raw datatype? blob or clob?

    How can i read a stored picture in oracle Long Raw datatype? Like a blob or clob?....i am using jdk 1.3
    This is because...i tried to read it like a blob but i obtain a exception...about Type of column no valid......but the column exist....and it contains the long raw datatype of the pictures.....this is my code:
    import java.sql.*;
    import java.io.*;
    import java.util.*;
    import oracle.jdbc.driver.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.io.InputStream;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.OutputStream;
    import java.sql.Connection;
    import java.sql.Statement;
    import java.sql.ResultSet;
    import java.sql.DriverManager;
    import oracle.sql.BLOB;
    import oracle.sql.BLOB.*;
    import oracle.jdbc.driver.*;
    import java.sql.*;
    class rec_ima1
    public static void main(String h[])
    Connection con = null;
    Blob bl;
    final ImageIcon image1;
    JPanel photo;
    try
    Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
    con= DriverManager.getConnection("jdbc:oracle:thin:@123.3.12.213:1521:db_name","user","password");
    String query = "Select * from pictures where ID = '18840'";
    Statement stmt = con.createStatement();
    ResultSet rs = stmt.executeQuery( query );
    if (!rs.next())
    System.out.println("Empty Result Set");
    bl = rs.getBlob(5);
    if (bl == null) {
    System.out.println("Null Blob");
    return;
    InputStream is = bl.getBinaryStream();
    int imageLength = (int) bl.length();
    System.out.println(imageLength);
    System.out.println(bl.length());
    byte[] imageData = new byte [imageLength];
    is.read(imageData, 0, imageLength);
    image1 = new ImageIcon(imageData);
    photo = new JPanel() {
    public void paint(Graphics g){
    g.setColor(Color.lightGray);
    g.drawImage(image1.getImage(), 0, 0, this);
    } catch (Exception e) {
    e.printStackTrace();
    Now i tried using clob:
    import java.sql.*;
    import java.io.*;
    import java.util.*;
    import oracle.jdbc.driver.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.io.InputStream;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.OutputStream;
    import java.sql.Connection;
    import java.sql.Statement;
    import java.sql.ResultSet;
    import java.sql.DriverManager;
    import oracle.sql.CLOB;
    import oracle.sql.CLOB.*;
    import oracle.jdbc.driver.*;
    import java.sql.CallableStatement;
    class rec_ima4
    public static void main(String h[])
    Connection con = null;
    Clob cl;
    JPanel photo;
    try
    Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
    con= DriverManager.getConnection("jdbc:oracle:thin:@123.3.12.213:1521:db_name","user","password");
    con.setAutoCommit (false);
    String query = "Select * from pictures where ID = '18840'";
    Statement stmt = con.createStatement();
    ResultSet rs = stmt.executeQuery( query );
    while (rs.next()) {
    oracle.sql.CLOB clob = (CLOB) rs.getObject(5); //line 47
    } catch (Exception e) {
    e.printStackTrace();
    This is the runtime exception:
    java.lang.ClassCastException: [B
    at rec_ima4.main(rec_ima4.java:47)

    Thanks by answering to me......
    Well....i did that....but what is ImageIO?....
    I declared a ImageIcon imageIO, but this give me the following:
    rec_ima3.java:49: cannot resolve symbol
    symbol : class BufferedImage
    location: class rec_ima3
    BufferedImage bi = ImageIO.read(bInput);
    ^
    rec_ima3.java:49: cannot resolve symbol
    symbol : variable ImageIO
    location: class rec_ima3
    BufferedImage bi = ImageIO.read(bInput);
    ^
    What classes i have to import?.....what is ImageIO?
    Thanks

Maybe you are looking for

  • Was lied to back in March about a contract.

    Ok, back story.  Back in March I offered to help a friend with a phone line when she was on hard times.  Asked the rep at the store if it would be possible to cancel that line when my other contract was up, by "swapping" the contract to my current ph

  • How to Populate G/L Account dynamically in txn IW31

    Hello, We have a scenario to Populate G/L Account dynamically from Automatic Account determination in txn IW31 ...Is there any user exit Thanks and Regards Venkat

  • VAT No. Set up for BP

    Hi Experts, In A/R invoice i need the Customer's VAT no to be printed. How can we set BP (customer & Vendor) VAT no in SBO 2007B PL19 and fetch the same in PLD? Thanks in advance Regards, Rupa Sarkar

  • On demand Expand list.

    Hi, I recently started using spry framework.i successfully implemented the dropdown functionality using coldfusion(for dynamic xml). now i am working on a dynamic report functionality. - there will be a report with only 5 rows displayed at a time. -t

  • Help with setting up Tiem Capsule on existing DSL network

    I am trying to connect my Time Capsule up to an existing network. I used Airport Utility to setup the Time capsule with the correct WEP password etc.; the dialog box says I successfully set up the Time Capsule. The box then says it is trying to conne