org.apache.ibatis.exceptions.PersistenceException: ### Error querying database. Cause: java.sql.SQLSyntaxErrorException: 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 'form tb_user where username='zhangsan' and password='1234'' at line 1 ### The error may exist in com/zxl/mapper/UserMapper.java (best guess) ### The error may involve com.zxl.mapper.UserMapper.select-Inline ### The error occurred while setting parameters ### SQL: select * form tb_user where username=? and password=? ### Cause: java.sql.SQLSyntaxErrorException: 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 'form tb_user where username='zhangsan' and password='1234'' at line 1 org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30) org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:153) org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:145) org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:140) org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:76) org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:87) org.apache.ibatis.binding.MapperProxy$PlainMethodInvoker.invoke(MapperProxy.java:145) org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:86) com.sun.proxy.$Proxy10.select(Unknown Source) com.zxl.servlet.LoginServlet.doGet(LoginServlet.java:37) com.zxl.servlet.LoginServlet.doPost(LoginServlet.java:58) javax.servlet.http.HttpServlet.service(HttpServlet.java:652) javax.servlet.http.HttpServlet.service(HttpServlet.java:733) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
报错:查看sql语句是否有问题,可在报错信息中查看发生错误的行数,检查sql语句,注意细节,特别是单词、符号的错误。



