SQL运行报错:java.sql.SQLException: sql injection violation, syntax error: syntax error, expect ‘)‘, pos

在尝试批量插入数据时遇到异常,错误信息提示存在SQL注入违规和语法错误,具体为在某个位置期望)但未找到。问题不仅出现在含有数据的插入,即使数据为空时也会报相同的错误。已检查SQL语句,未发现明显问题。错误可能源自我方项目中的某个jar包中的XML映射文件。现在需要进一步排查是否SQL语句在处理空值时存在特殊逻辑或配置错误。

批量插入的sql,运行时报错

发现异常:class_method=com.**, args=[03eb14a8925940fa9299335d1969bfd1, true], 异常信息:org.springframework.jdbc.UncategorizedSQLException: 
### Error updating database.  Cause: java.sql.SQLException: sql injection violation, syntax error: syntax error, expect ')', pos 416, line 6, column 16, token EOF : insert into **_i_detail(`id`,`book_id`,`month`,`invoice_id`,
                                               `line`,`goods_name`,`model`,
                                               `unit`,`number`,`price`,
                                               `money`,`tax_rate`,`tax_money`,
                                               `card_no`,`card_type`,`card_id_no`,`factory_model`)
        values
### The error may exist in URL [jar:file:/data/*/*.jar!/BOOT-INF/lib/*-biz-c.2.3.6-SNAPSHOT.jar!/*/*Mapper.xml]

检查sql,检查了几遍,没什么问题

后来发现,当插入的数据为空时,也会报   expect ')',   错误

{ "timestamp": "2023-07-14T11:17:15.188+0000", "status": 500, "error": "Internal Server Error", "message": "\r\n### Error querying database. Cause: java.sql.SQLException: sql injection violation, syntax error: syntax error, error in :'RDER BY province_id LIMIT 1', expect BY, actual BY pos 98, line 3, column 56, token BY : SELECT *\n FROM batch_control_line\n WHERE province_id = ? AND `year`=? LIMIT ORDER BY province_id LIMIT 1\r\n### The error may exist in mybatis/mapper/BatchControlLineMapper.xml\r\n### The error may involve com.college.collegesystem.dao.BatchControlLineMapper.findBatchControlLineByID\r\n### The error occurred while executing a query\r\n### SQL: SELECT * FROM batch_control_line WHERE province_id = ? AND `year`=? LIMIT ORDER BY province_id LIMIT 1\r\n### Cause: java.sql.SQLException: sql injection violation, syntax error: syntax error, error in :'RDER BY province_id LIMIT 1', expect BY, actual BY pos 98, line 3, column 56, token BY : SELECT *\n FROM batch_control_line\n WHERE province_id = ? AND `year`=? LIMIT ORDER BY province_id LIMIT 1\n; uncategorized SQLException; SQL state [null]; error code [0]; sql injection violation, syntax error: syntax error, error in :'RDER BY province_id LIMIT 1', expect BY, actual BY pos 98, line 3, column 56, token BY : SELECT *\n FROM batch_control_line\n WHERE province_id = ? AND `year`=? LIMIT ORDER BY province_id LIMIT 1; nested exception is java.sql.SQLException: sql injection violation, syntax error: syntax error, error in :'RDER BY province_id LIMIT 1', expect BY, actual BY pos 98, line 3, column 56, token BY : SELECT *\n FROM batch_control_line\n WHERE province_id = ? AND `year`=? LIMIT ORDER BY province_id LIMIT 1", "trace": "org.springframework.jdbc.UncategorizedSQLException: \r\n### Error querying database. Cause: java.sql.SQLException: sql injection violation, syntax error: syntax error, error in :'RDER BY province_id LIMIT 1', expect BY, actual BY pos 98, lin
07-15
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值