My Oracle Support Banner

ClassCastException With 11.2.0.2 Oracle JDBC Driver When Getting XMLTYPE Column Value (Doc ID 1305209.1)

Last updated on AUGUST 30, 2023

Applies to:

JDBC - Version 11.2.0.2.0 to 11.2.0.2.0 [Release 11.2]
Information in this document applies to any platform.

Symptoms

When getting XMLTYPE column value as an oracle.xdb.XMLType object,
with the version 11.2.0.2 of  Oracle JDBC driver, the following exception is thrown:

java.lang.ClassCastException: oracle.jdbc.driver.OracleSQLXML cannot be cast to oracle.xdb.XMLType



To illustrate this problem, the warehouse_spec XMLTYPE column is defined and filled as the following:


JDK 6 version is used, and,the CLASSPATH contains the 11.2.0.2 ojdbc6.jar (Oracle JDBC driver, OH/jdbc/lib directory ), xdb.jar (XDB product, OH/RDBMS/jlib directory) and xmlparserv2.jar (XDK product, OH/lib directory) libraries. (OH stands for the  Oracle Home 11.2.0.2 database server directory).



Cause

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


In this Document
Symptoms
Cause
Solution
References

My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.