为提高效率,提问时请提供以下信息,问题描述清晰可优先响应。
【DM版本】: DM Database Server 64 V8 03134284194-20240703-234060-20108
【操作系统】:麒麟V10
【CPU】: 鲲鹏920
【问题描述】*:
数据表里面有一个字段 名为“week”, 适配达梦后有如下报错,
请问如何在不修改字段名的情况下解决?
org.springframework.dao.DataIntegrityViolationException:
### Error updating database. Cause: dm.jdbc.driver.DMException: 第1 行附近出现错误:
无效的列名[week]
### The error may exist in com/inx/inx/inx/mapper/InxMapper.java (best guess)
### The error may involve com.inx.inx.inx.mapper.InxMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO dm_inx ( id, x1_id, x2_id, x3_name, inx_code, inx_url, inx_scope, inx_mode, inx_begin_time, inx_end_time, choose_begin_time, choose_end_time, is_share, inx_status, is_limit_stu, week, create_time, update_time, create_id, create_user ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: dm.jdbc.driver.DMException: 第1 行附近出现错误:
无效的列名[week]
; 第1 行附近出现错误:
无效的列名[week]; nested exception is dm.jdbc.driver.DMException: 第1 行附近出现错误:
无效的列名[week]
关键字可以使用'week'单引号扩起来,或者修改dm.ini EXCLUED_RESERVED_WORDS参数值
尝试了上面两个方案,都没有解决问题
最后是通过改字段名为 weeks,并且 jdbc加了 genKeyNameCase=2,但还是很迷糊其中的原因
关键字冲突了,在jdbc url 里添加 keyWords=week