急救,java.sql.BatchUpdateException: Statement length exceeds maximum.

dong_tianjin 2007-11-30 09:43:38
在使用INFORMIX数据库时报的这个异常,不知道该怎么解决,急救!谢谢!

java.sql.BatchUpdateException: Statement length exceeds maximum.
at com.informix.jdbc.IfxStatement.executeBatch(IfxStatement.java:1635)
at com.ist.server.database.SQLExecute.exeStatementBatch(SQLExecute.java:461)
at com.ist.server.cal.aml.dao.T47_transactionDao.insertRuleObj(T47_transactionDao.java:686)
at com.ist.server.cal.aml.jcindic.CalJCindic.cal(CalJCindic.java:273)
at com.ist.server.cal.BaseCalUnit.runInsert(BaseCalUnit.java:73)
at com.ist.server.cal.BaseCalMain.RunInsert(BaseCalMain.java:56)
at com.ist.server.cal.BaseTasks.insertResult(BaseTasks.java:75)
at com.ist.server.cal.BaseTasks.executeTask(BaseTasks.java:48)
at com.ist.server.AuditServer.executeTasks(AuditServer.java:204)
at com.ist.server.AuditServer.access$0(AuditServer.java:95)
at com.ist.server.AuditServer$1.run(AuditServer.java:75)
at java.util.TimerThread.mainLoop(Timer.java:432)
at java.util.TimerThread.run(Timer.java:382)
2007-11-25 13:46:10,806 Thread-0 ERROR (T47_transactionDao.java:689) -

...全文
558 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
致知Fighting 2011-04-11
  • 打赏
  • 举报
回复
是说你的要插入的 数据超过了表的某列定义的长度。

自己检查一下数据表的设计,把对应的定义的最大长度改大一点就OK了
pingping716827 2011-04-11
  • 打赏
  • 举报
回复
我执行存储过程是报的就是这个错误,要怎么解决呀
longmain 2007-12-09
  • 打赏
  • 举报
回复
我也遇到同样的问题。在批量执行sql的时候Informix说我的语句超过了最大长度。我的到了错误代码-79864。
Informix提供的FIND ERROR工具对这个错误代码给出了如下解释:
-79864

__________________________________________________________ Statement length exceeds the maximum.

Your application issued an SQL PREPARE, DECLARE, or EXECUTE IMMEDIATE statement that is longer than the database server can handle. The limit differs with different implementations but in most cases is up to 32,000 characters.

Review the program logic to ensure that an error has not caused your application to present a string that is longer than intended. If the text has the intended length, revise the application to present fewer statements at a time.

This error is the same as error -460 that the database server returns.


看来需要把超常的sql语句拆分后分组执行。
我写了验证长度的一个方法,把要批量执行的sql语句拆分成多个组,再依次执行。
这样做只能解决批量执行的问题,仍然不能解决过长的sql。
如果sql真的很长,我认为需要从逻辑上拆分成几个单元。顺序执行。
再不然,就要考虑存储过程了。

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧