使用 Ibatis 2.3 检索 CLOB 数据

发布于 2024-12-02 16:52:34 字数 2177 浏览 2 评论 0原文

我正在尝试从 oracle 数据库检索 clob 数据,如 reports.xml 中所示。我正在使用 oracle jdbc 驱动程序版本“Oracle JDBC 驱动程序版本 - 10.0.2.0.0”。以下是我收到的错误,请告诉我如何解决这个问题。

2011-08-31 13:03:40,790 WARN  [org.apache.struts.chain.commands.AbstractExceptionHandler] (http-10.12.230.222-8080-1) Unhandled exception
com.ibatis.common.jdbc.exception.NestedSQLException:   
--- The error occurred in sa/mobily/telecop/dao/config/GenericReportQuery.xml.  
--- The error occurred while applying a parameter map.  
--- Check the runReportQuery-InlineParameterMap.  
--- Check the parameter mapping for the 'QUERY' property.  
--- Cause: java.sql.SQLException: Data size bigger than max size for this type: 6411
    at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryWithCallback(MappedStatement.java:201)
    at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryForList(MappedStatement.java:139)
    at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:567)
    at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:541)
    at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:118)
    at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForList(SqlMapClientImpl.java:94)

reports.xml

<select id="getReportQuery"  parameterClass="java.util.HashMap" resultMap="queryStringData" >
        select REPORT_QUERY 
         from frd_rep_fw_reports where report_id=#REP_ID# AND report_type='P' 
</select> 
<resultMap id="queryStringData" class="java.util.HashMap">
  <result column="REPORT_QUERY" property="QRY_BODY" javaType="java.lang.String" jdbcType="CLOB"  typeHandler="com.ibatis.sqlmap.engine.type.ClobTypeHandlerCallback" />
</resultMap>    

sqlmapconfig.xml

<dataSource type="JNDI">
        <property name="DataSource" value="${connection.datasource}"/>
        <property name="Driver.SetBigStringTryClob" value="true"/>
    </dataSource>

I am trying to retrieve a clob data from the oracle database as shown in reports.xml.i am using oracle jdbc driver version "Oracle JDBC Driver version - 10.0.2.0.0" . The following are the errors i receive ,kindly let me know ,how to resolve this.

2011-08-31 13:03:40,790 WARN  [org.apache.struts.chain.commands.AbstractExceptionHandler] (http-10.12.230.222-8080-1) Unhandled exception
com.ibatis.common.jdbc.exception.NestedSQLException:   
--- The error occurred in sa/mobily/telecop/dao/config/GenericReportQuery.xml.  
--- The error occurred while applying a parameter map.  
--- Check the runReportQuery-InlineParameterMap.  
--- Check the parameter mapping for the 'QUERY' property.  
--- Cause: java.sql.SQLException: Data size bigger than max size for this type: 6411
    at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryWithCallback(MappedStatement.java:201)
    at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryForList(MappedStatement.java:139)
    at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:567)
    at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:541)
    at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:118)
    at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForList(SqlMapClientImpl.java:94)

reports.xml

<select id="getReportQuery"  parameterClass="java.util.HashMap" resultMap="queryStringData" >
        select REPORT_QUERY 
         from frd_rep_fw_reports where report_id=#REP_ID# AND report_type='P' 
</select> 
<resultMap id="queryStringData" class="java.util.HashMap">
  <result column="REPORT_QUERY" property="QRY_BODY" javaType="java.lang.String" jdbcType="CLOB"  typeHandler="com.ibatis.sqlmap.engine.type.ClobTypeHandlerCallback" />
</resultMap>    

sqlmapconfig.xml

<dataSource type="JNDI">
        <property name="DataSource" value="${connection.datasource}"/>
        <property name="Driver.SetBigStringTryClob" value="true"/>
    </dataSource>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

趴在窗边数星星i 2024-12-09 16:52:34

获取最新的 ojdbc14.jar 我应该可以工作。另请让我知道表 frd_rep_fw_reports 是如何定义的

Get the latest ojdbc14.jar and i should work. Also let me know how the table frd_rep_fw_reports is defined

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文