本文主要是介绍mybatis 如何定位sql injection violation, syntax error: ERROR. pos 998, line 14, column 41, token ON : 错误,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
改SQL的时候如果遇到了这个问题,一般在navicat中能运行,但是在程序中就报错,这一类问题,难定位!
比如:遇到如下,
解析异常,e=查询异常,msg=数据查询失败,请检查sql语句是否准确 error : Error querying database. Cause: java.sql.SQLException: sql injection violation, syntax error: ERROR. pos 998, line 14, column 41, token ON : selectb.UUID as "uuid",b.OPR_UUID as "oprUuid",b.SOURCE_ID as "sourceId",b.STS as "sts" ,g.ZS_SEQ_NO as "zsSeqNo",g.CREATE_TIME as "createTime",t.orsc_mno as "tranCorgNo",t.tran_dt as "tranDt",a.IN_MNO as "inMno",a.TRAN_ORG_DT as "tranOrgDt",a.ORDER_TYPE as "jftype",a.TRAN_ORG_UUID as "tranOrgUuid",a.TRAN_CRD_NO as "tranCrdNo",a.TRAN_ORG_AMT as "tranOrgAmt",g.AMT as "amt",b.AMT as "amt2",g.PROCESS_TYPE as "processType",b.DUTY_PARTY_TYP as "dutyPartyTyp",b.DUTY_PARTY_NO as "dutyPartyNo",b.DUTY_PARTY_NM as "dutyPartyNm",g.UPDATE_TIME as "updateTime",b.REMARK as "remark",if.MNO as "mno",a.SOURCE_TYPE as "sourceType"from DCM_OWNER.T_MBS_OPR_DTL b left join DCM_OWNER.T_MBS_ZS_IF g on b.SOURCE_ID=g.UUIDleft join DCM_OWNER.t_mbs_bm_order_if a on g.bm_uuid=a.uuidleft join DCM_OWNER.t_pts_trandata t on t.uuid = a.source_idleft join DCM_OWNER.t_mbs_opr_if c on c.uuid=b.opr_uuidleft join DCM_OWNER.t_bap_mec_if if on if.in_mno=a.in_mnoWHERE (a.SOURCE_TYPE = '1' or a.SOURCE_TYPE = '3')
复制代码: 从 select 开始复制, 如下示意
Error querying database. Cause: java.sql.SQLException: sql injection violation, syntax error: ERROR. pos 998, line 14, column 41, token ON : select
复制到sql的最后, 把复制的sql 拷贝到 Notepad++ 编辑器中,鼠标定位到 pos 998, line 14, column 41,问题就是出在在这个地方.
这个地方的 Pos 不一样.是因为上面的代码我是拷贝别人的. 我自己的试过了修复了问题,
这篇关于mybatis 如何定位sql injection violation, syntax error: ERROR. pos 998, line 14, column 41, token ON : 错误的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!