I Am Trying To Extract An Xmltype Column From An Oracle Table Using Jdbc And Having Some Issues
Solution 1:
You can't retrieve this as string (varchar), because of limitations of varchar lenght (4000bytes). Select it as CLOB:
Stringquery="SELECT TBL.XMLTYPECOLUMN.GETCLOBVAL() FROM TABLE TBL";
rs = stmt.executeQuery(query);
xmlClob = (Clob) rs.getClob(1);
http://kodehelp.com/how-to-read-xmltype-column-from-database-using-jdbc/
Solution 2:
Have to use to_clob in the query
select
to_clob(xmlelement ( "employee", 'Bob' )) ) as SQLXMLCOL1 from dual
then use the toString() in resultSet
Solution 3:
Do you mean your call to result.toString() is returning null? If so, that's not how you get the data from the result set anyway. I tried a couple of different test, using the DataDirect Oracle JDBC driver and only got null from result.toString(). If I call rs.getString() for the XMLType column, I would get the XML data I inserted; Calling getObject() returned to LOB locator (I think, didn't double check) that references the data. Printing that did not give me the data, just the ID for the locator.
Post a Comment for "I Am Trying To Extract An Xmltype Column From An Oracle Table Using Jdbc And Having Some Issues"