在 WebSphere 6.1 中配置数据源以支持 Oracle 11g XML-DB
我正在使用 Oracle 的 XML 数据库功能,该列定义为 SYS.XMLTYPE。我正在使用下面的 JDBC 代码来选择/更新此字段。
XMLType xmlType = (XMLType) rs.getObject(1);
stmt.setObject(1, XMLType.createXML(connection, xmlString));
我必须在 Tomcat 的 context.xml 中配置数据源,如下所示才能使其正常工作(通过添加以下类型、工厂和 driverClassName)。
<Resource
type="oracle.jdbc.pool.OracleDataSource"
factory="oracle.jdbc.pool.OracleDataSourceFactory"
driverClassName="oracle.jdbc.driver.OracleDriver"
...
但是,在 WebSphere 中部署时,我遇到以下异常。有人可以帮助我在 WAS 6.1 中使用等效的数据源配置来消除这些错误吗?
java.lang.ClassCastException: oracle.sql.OPAQUE incompatible with oracle.xdb.XMLType
java.lang.ClassCastException: com.ibm.ws.rsadapter.jdbc.WSJdbcConnection incompatible with oracle.jdbc.OracleConnection
I am using Oracle's XML database feature and the column is defined as SYS.XMLTYPE
. I am using the below JDBC code to select/update this field.
XMLType xmlType = (XMLType) rs.getObject(1);
stmt.setObject(1, XMLType.createXML(connection, xmlString));
I had to configure the data source in Tomcat's context.xml as below to get it to work (by adding the following type, factory and driverClassName).
<Resource
type="oracle.jdbc.pool.OracleDataSource"
factory="oracle.jdbc.pool.OracleDataSourceFactory"
driverClassName="oracle.jdbc.driver.OracleDriver"
...
However, when deploying in WebSphere I am getting the below Exceptions. Could anybody help me with the equivalent data source configuration in WAS 6.1 to get rid of these errors?
java.lang.ClassCastException: oracle.sql.OPAQUE incompatible with oracle.xdb.XMLType
java.lang.ClassCastException: com.ibm.ws.rsadapter.jdbc.WSJdbcConnection incompatible with oracle.jdbc.OracleConnection
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试一下,看看是否可以为您提供所需的答案
http://community.jboss.org/wiki/MappingXMLToOracleXMLTYPEInIBMWebspsherePlatform
HTH
曼格鲁
Try this and see if that provides you with the required answers
http://community.jboss.org/wiki/MappingXMLToOracleXMLTYPEInIBMWebspsherePlatform
HTH
Manglu
我知道您不想陷入 WSCallHelper 沼泽,但不幸的是我必须同意普遍的建议。不久前,我在 Oracle 和 CLOB/BLOB 方面也遇到过类似的情况(在他们根据驱动程序中的 JDBC 标准实现这一点之前),当您必须访问容器托管资源中的原始 JDBC 驱动程序时,WSCallHelper 实际上是唯一的出路/水池。
I understand that you don't want to dive down the WSCallHelper swamp, but unfortunately I have to concur with prevailing suggestion. I had a similar situation a while back with Oracle and CLOB/BLOB (before they implemented that according to the JDBC standards in the driver) and WSCallHelper was really the only way forward when you have to access the raw JDBC driver in a container managed resource/pool.