zoukankan      html  css  js  c++  java
  • 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 '%逸%'

  • 相关阅读:
    .Net 多线程小结
    VIM 入门操作
    C语言中的数据
    对scanf和printf的研究!!
    C语言常用的编程规范
    ORACLE GOLDEN GATE oracle同步数据至kafka
    mysql5.7关于使用到OR是否会用到索引并提高查询效率的探讨
    sysbench安装
    percona数据库监控工具的安装部署
    redhat6 快速部署percona
  • 原文地址:https://www.cnblogs.com/xyblogs/p/8723645.html
Copyright © 2011-2022 走看看