应用忽然报错,一直在刷如下错误:
org.springframework.dao.DataIntegrityViolationException:
### Error querying database. Cause: com.ibm.db2.jcc.am.SqlDataException: DB2 SQL Error: SQLCODE=-302, SQLSTATE=22001, SQLERRMC=null, DRIVER
=3.64.96
### The error may exist in file [E:\mapper文件路径](这里非关键,隐藏)
### The error may involve defaultParameterMap
### The error occurred while setting parameters
### SQL: select * from XXX? (这里非关键,隐藏)
### Cause: com.ibm.db2.jcc.am.SqlDataException: DB2 SQL Error: SQLCODE=-302, SQLSTATE=22001, SQLERRMC=null, DRIVER=3.64.96
; SQL []; DB2 SQL Error: SQLCODE=-302, SQLSTATE=22001, SQLERRMC=null, DRIVER=3.64.96; nested exception is com.ibm.db2.jcc.am.SqlDataExceptio
n: DB2 SQL Error: SQLCODE=-302, SQLSTATE=22001, SQLERRMC=null, DRIVER=3.64.96
at org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.doTranslate(SQLStateSQLExceptionTranslator.java:101)
at
上面的报错来看,问题在注值那里报错,检查sql无异常,代码也无大问题,数据库的字段长度也是没什么问题的。
最后找到一个, 设置环境变量DB2_DEFERRED_PREPARE_SEMANTICS=YES
问题解决