• You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'like '%逸%'' at line 1


     1 <?xml version="1.0" encoding="UTF-8"?>
     2 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
     3 <!-- 命名空间要和接口的全限定名相同 -->
     4 <mapper namespace="com.imp.IStudents">
     5 <select id="selectLike" parameterType="String" resultType="students">
     6      select * from students where name like '%${value}%'
     7 </select>
     8 
     9   
    10 </mapper>
    IStudents.xml

    org.apache.ibatis.exceptions.PersistenceException:
    ### Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'like '%逸%'' at line 1
    ### The error may exist in com/imp/IStudents.xml
    ### The error may involve com.imp.IStudents.selectLike-Inline
    ### The error occurred while setting parameters
    ### SQL: select * from students name like '%逸%'
    ### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'like '%逸%'' at line 1

    错误原因:select语句写错了

    select * from students where name like '%逸%'

  • 相关阅读:
    排序规则
    revert
    添加字段modify
    修改字段名change
    修改字段注释modify
    修改字段类型modify
    file类型input框赋值
    disabled
    js失去焦点触发
    别把软件开发当做养家糊口的工具...
  • 原文地址:https://www.cnblogs.com/xyblogs/p/8723645.html
Copyright © 2020-2023  润新知