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