Environment: Oracle 11g, Weblogic 9.2, Java 4, driver: oracle.jdbc.OracleDriver
Context: I want to extract an xml value from a database and work with the result in Java, using the following select:
SELECT EXTRACT(XML_TEXT, 'PATH/TO/XML/VALUE/text()').getClobVal() AS VALUE
FROM MYTBALE WHERE id =xxxx;
Problem: In the SQL Developer, I do can see the string retreived fine, but in Java:
- If I use the
getClobVal()function Weblogic returns a wrapped object of typeweblogic.jdbc.wrapper.Clob_oracle_sql_CLOBwhich I'm not able to cast or unwrap. - If I don't use
getClobVal()returns anoracle.sql.Opaque, which I'm not able to cast to anything either.
Code:
Using getClobVal():
...
HashMap <String, Object> element = (HashMap) iter.next();
String value = (unwrap & cast in some way ) element.get("VALUE");
...
I can't find a way to get the string from that object, any ideas?
EDIT: I can't disable Weblogic wrapping. I'm thinking in making some workaround in database side to get a blob instead.