Home » Developer & Programmer » JDeveloper, Java & XML » XMLType use in WebSphere (Oracle10g, WebSphere Application Server 6.1)
XMLType use in WebSphere [message #357802] Thu, 06 November 2008 12:26
technomom
Messages: 1
Registered: November 2008
Junior Member
Hi all,

I have a DB2 V9.1 database used by a WebSphere AppServer 6.1 servlet which I need to replicate on Oracle 10g. There are a few tables which have columns of XMLTYPE in DB2. I want use the Oracle XMLTYPE in such a way that I can maintain as little JDBC code as necessary to support DB instances of both flavors.

In DB2 V9, I have no problem doing a prepared statement that returns the XMLType XML using a rs.getString(my_xml_column_name).
But in Oracle 10g, this does not work, the getString returns null even though I can see using other clients that there is valid XML in the field.

I see in the app dev guide,
http://www.stanford.edu/dept/itss/docs/oracle/10g/appdev.101/b10790/xdb11jav.htm that I can use code of the form...

import oracle.xdb.XMLType;
...
PreparedStatement stmt = conn.prepareStatement(
"select e.poDoc from po_xml_tab e");
ResultSet rset = stmt.executeQuery();
while(rset.next())
{
// get the XMLType
XMLType poxml = (XMLType)rset.getObject(1);

// get the XML as a string...
String poString = poxml.getStringVal();
}

To do this, I have to drag along xdb.jar, xmlparserv2.jar, and ojdbc14.jar. So, my question is twofold:

(1) Is there a better, vendor agnostic way to do this?

(2) If this is the only way, then where is the best place to put the jar files for reference by the servlet? In the EAR of the servlet? In a shared library on the classpath of the application server? In the datasource provider classpath?

UPDATE: I tried the following:
1. When I put the jar files in the servlet war file, I get a ClassCastException from java.sql.OPAQUE to oracle.xdb.XMLType.

2. When I put the files into either a shared library or into the datasource provider classpath, the code works but I get several exceptions (one of which disables WebSphere's Admin Console, not good) which I have narrowed down to the use of xmlparserv2.jar, which must collide with WebSphere's XML parsing.

So, I'm at a loss as to how to integrate Oracle XMLType parsing into WebSphere 6.1 servlets. Can anyone provide some guidance?

Thanks to anyone who can help. .

JoAnn

[Updated on: Thu, 06 November 2008 17:15]

Report message to a moderator

Previous Topic: How to persist into 2 or more table
Next Topic: XML Output for from Oracle
Goto Forum:
  


Current Time: Sun Oct 26 00:15:18 CDT 2014

Total time taken to generate the page: 0.13135 seconds