Forum Stats

  • 3,759,454 Users
  • 2,251,545 Discussions
  • 7,870,648 Comments

Discussions

java.lang.ClassCastException: weblogic.jdbc.wrapper.Blob_oracle_sql_BLOB??

612177
612177 Member Posts: 21
edited Feb 14, 2012 7:33AM in JDeveloper and ADF
Hello. I'm trying to bring back a BLOB object from a PL/SQL procedure. I keep getting a class cast exception when I do it

java.lang.ClassCastException: weblogic.jdbc.wrapper.Blob_oracle_sql_BLOB cannot be cast to oracle.sql.BLOB

I get similar results with oracle.sql.BLOB or java.sql.Blob.

What I've noticed is that when I'm not using a JDBC URL with my AM to do the SQL it does not fail. It's when I change to a JDBC Datasource I get the class cast exception. Any ideas?

Thanks, Graeme.

Answers

  • John Stegeman
    John Stegeman Member Posts: 24,269 Blue Diamond
    WLS properly wraps all vendor-specific types when using a connection pool. What you can do is to check the connection you are using to call the stored proc, and if it is a WL connection, call getVendorConnection() on it to get the oracle connection which is being wrapped.

    John
    John Stegeman
  • 612177
    612177 Member Posts: 21
    Thanks for the response. How do I get the WLConnection to get the getVendorConnection method available? I have the DBTransaction class from my AM, but I can't cast it to a WLConnection class to use that method. Any ideas how to do this?

    Thanks.
  • 890035
    890035 Member Posts: 1
    In the connection pool uncheck the property "Wrap Data Types".

    By default, data type objects for Array, Blob, Clob, NClob, Ref, SQLXML, and Struct, plus ParameterMetaData and ResultSetMetaData objects are wrapped with a WebLogic wrapper. This allows for features like debugging and connection usage to be done by the server.
    The wrapping can be turned off by setting this value to false. This improves performance, in some cases significantly, and allows for the application to use the native driver objects directly.
  • 686149
    686149 Member Posts: 217
    Hi

    I am using Weblogic 10.3.0. I am also getting the same exception. But I don,'t see the option of unchecking Wrap Data Types under Connection Pool , Adavanced settings.

    Could you please tell me how do I disable this option in weblogic 10.3.0.

    Regards
    Praveena
This discussion has been closed.