Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How do I get an OraclePreparedStatement from a DataSource?

I'm trying to parse XML data types from an Oracle 10g database. The Oracle recommended way of doing this is as follows:

Connection conn = ....
OraclePreparedStatement stmt = (OraclePreparedStatement)conn.prepareStatement( "..." );
OracleResultSet rs = (OracleResultSet)stmt.execute();
while( rs.next() ) {
	OPAQUE opaque = rs.getOPAQUE(1);
	XMLType xml = opaque.createXML( opaque );
	...
}

and then you go from there. This all works great when I manually create the connection using the non-j2ee method of directly connecting to the database using the jdbc:oracle:thin driver. However, when I try to allocate a connection using the J2EE defined data source, I can't do the above since the classes returned to me are SAP types, and don't take kindly to being cast to Oracle types.

Is there a way to do this? I've done some digging, but I haven't found the end of the tunnel yet I can always connect directly to the database, but I would rather use the data source management service of the J2EE engine.

Thanks!

Former Member
Not what you were looking for? View more on this topic or Ask a question