最近开发项目,跑批处理遇到一个问题:
2013-07-28 09:53:35,715[P17Quartz_CAScheduler_Worker-7]ERROR
[JobRunShell]run(line:211)Job DEFAULT.propertySmsJobDetail threw an
unhandled Exception:
org.springframework.jdbc.UncategorizedSQLException:
StatementCallback; uncategorized SQLException for SQL [update
T_CC_L2_SMS_Send set LastUpt_Dttm=to_date('2013-07-28
09:53:35','yyyy-mm-dd hh24:mi:ss'), ENABLE_FLG = '2' where ACT_ID
=350791104]; SQL state [null]; error code [17081]; 批处理中出现错误: ORA-00972:
标识符过长
; nested exception is java.sql.BatchUpdateException: 批处理中出现错误: ORA-00972: 标识符过长
==============================================
报错是因为SQL语句:
update T_CC_L2_SMS_Send set LastUpt_Dttm=to_date('2013-07-28 09:53:35','yyyy-mm-dd hh24:mi:ss'), ENABLE_FLG = '2' where ACT_ID
=350791104
但是该语句在PL-SQL 单独运行时正常的。 而且该quartz的从去年9月份到现在都没有改动过。 昨天忽然出错。
我初步分析可能原因如下:
1 因为报错的方法如下, 怀疑入参的数据组的长度,超出的batchUpdate的,比如达到 1000条。
/**
* SQL批处理
*/
public void bachUpdate(String[] sql){
this.getJdbcTemplate().batchUpdate(sql);
}
2 怀疑SQL:update T_CC_L2_SMS_Send set LastUpt_Dttm=to_date('2013-07-28
09:53:35','yyyy-mm-dd hh24:mi:ss'), ENABLE_FLG = '2' where ACT_ID
=350791104
其中【ACT_ID =350791104】 应该写成【ACT_ID ='350791104'】,但是该字段act_id 的类型为number(10) ,按理应该可以执行的。
3 怀疑因为是批量处理,前面一批SQL 是insert语句,刚巧这个update语句是紧排在insert后面。 意思是出错的是上一个SQL,日志截获的是下一个SQL。
形如:
insert …………;
insert …………;
insert …………;(此句报错)
update T_CC_L2_SMS_Send set LastUpt_Dttm=to_date('2013-07-28
09:53:35','yyyy-mm-dd hh24:mi:ss'), ENABLE_FLG = '2' where ACT_ID
=350791104 (拦截此句)
网上关于标识符过长的解释 都无法说明原因;
=================================================================
最终结果,正如上述第3种的怀疑, 在调用Spring的JdbcTemplate.batchUpdate(String[] sqlArray)方法时,
因为是个Quartz的跑批处理程序,所以在在入参的数组中,包含了insert、update等语句。 其中一个最后一个
insert语句字段包含一个英文单引号,导致,后面的update语句报错:ORA-00972: 标识符过长。
但是,异常只给出了当前出错的SQL语句。
总结:在首次插入短信表记录事,采用是JdbcTemplate.update(String sql, Object args[]). 支持
字段中包含英文单引号,但是跑批时,为了提供性能,采用另一种方式
JdbcTemplate.batchUpdate(String[] sqlArray), 该方法不支持表字段中包含英文单引号。所以导致搞问题。
最终通过,采用统一的JdbcTemplate.update(String sql, Object args[]) 进行插入数据即可!
分享到:
相关推荐
java解决nested exception is java.lang.OutOfMemoryError Java heap space 解决OOM
java解决Handler processing failed; nested exception is java.lang.NoClassDefFoundError
java.sql.SQLException: 不支持的字符集 (在类路径中添加 orai18n.jar): ZHS16GBK ……
com.microsoft.sqlserver.jdbc.SQLServerException: 只进结果集不支持请求的操作 解决方案
搜集整理关于java错误处理:java.lang.OutOfMemoryError: Java heap space java.lang.OutOfMemoryError: Java heap space 资料整理
NULL 博文链接:https://bijian1013.iteye.com/blog/2305804
<groupId>com.squareup.okio</groupId> <artifactId>okio <version>2.8.0</version>
oracle实例的内存(SGA和PGA)进行调整,优化数据库性
NULL 博文链接:https://jameskaron.iteye.com/blog/2291495
ORA-29532: Java call terminated by uncaught Java exception: javax.mail.MessagingException: IOException while sending message; nested exception is: javax.activation.UnsupportedDataTypeException: no ...
nested exception is com.sun.jersey.api.client.UniformInterfaceException: PUT http://localhost:8090/picServer/uploads/QQ截图20200220003029.png returned a response status of 400 Bad Request type ...
主要给大家介绍了关于MySQL存储表情时报错:java.sql.SQLException: Incorrect string value: 'xF0x9Fx92xA9x0Dx0A...'的解决方法,文中通过示例代码介绍的非常详细,需要的朋友可以参考借鉴,下面来一起看看吧。
nested exception is: java.net.BindException: Address already in use: JVM_Bind 这里说的是1099端口被其它进程占用了. 二.解决办法 找出占用1099端口的进程,进入windows命令,查看什么进程占用了1099端口...
总是会出现这样那样的你想不到的问题。崩溃了。首先来罗列一下我遇到过的一些问题吧。 1、大小写敏感 2、连接数超过系统最大连接数 3、Can’t connect to local MySQL server through socket ‘/Data/mydata/mysql....
在搭建spring项目时通常需要这些jar包 commons-logging-1.1.3.jar spring-aop-4.0.6.RELEASE.jar ... nested exception is java.lang.NoClassDefFoundError: org/aopalliance/intercept/MethodInterceptor
nested exception is org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: java.lang.IllegalStateException: Cannot enable lazy loading because CGLIB is not ...
项目工程中用到jdk1.6相关方法,可以使用,但是升级到jdk1.8以后,编译出现java.lang.NoClassDefFoundError: sun/io/CharToByteConverter错误,后经查询,是jdk1.8版本中已经从sun.io.*中进行去除。网上找来了相关...
nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'transactionManagerBeanName' of bean class [org.springframework.transaction.interceptor....
Type 异常报告 消息 Failed to convert ... nested exception is java.lang.IllegalStateException: Cannot convert value of type 'java.lang.String' to required type 'java.util.Date': no matching editors or co
Later is supported when map2dbg.exe tool is placed in \Bin folder of EurekaLog installation (separate download is required) 5)....Added: Exception2HRESULT in EAppDLL to simplify developing DLLs with ...