报错--->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 'delect from testd

数据库   发布日期:2025年06月05日   浏览次数:144

报错--->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 'delect from testdb.test001 where id=9' at line 1

全部报错:

  1. org.apache.ibatis.exceptions.PersistenceException:
  2. ### Error updating 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 'delect from testdb.test001 where id=9' at line
  3. ### The error may exist in com/xian/dao/UserMapper.java (best guess)
  4. ### The error may involve com.xian.dao.UserMapper.delect-Inline
  5. ### The error occurred while setting parameters
  6. ### SQL: delect from testdb.test001 where id=?
  7. ### 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 'delect from testdb.test001 where id=9' at line
  8. at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:)
  9. at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:)
  10. at org.apache.ibatis.session.defaults.DefaultSqlSession.delete(DefaultSqlSession.java:)
  11. at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:)
  12. at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:)
  13. at com.sun.proxy.$Proxy8.delect(Unknown Source)
  14. at MapperTest.delect(MapperTest.java:)
  15. at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  16. at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:)
  17. at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:)
  18. at java.lang.reflect.Method.invoke(Method.java:)
  19. at org.junit.runners.model.FrameworkMethod$.runReflectiveCall(FrameworkMethod.java:)
  20. at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:)
  21. at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:)
  22. at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:)
  23. at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:)
  24. at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:)
  25. at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:)
  26. at org.junit.runners.ParentRunner$.run(ParentRunner.java:)
  27. at org.junit.runners.ParentRunner$.schedule(ParentRunner.java:)
  28. at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:)
  29. at org.junit.runners.ParentRunner.access$(ParentRunner.java:)
  30. at org.junit.runners.ParentRunner$.evaluate(ParentRunner.java:)
  31. at org.junit.runners.ParentRunner.run(ParentRunner.java:)
  32. at org.junit.runner.JUnitCore.run(JUnitCore.java:)
  33. at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:)
  34. at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:)
  35. at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:)
  36. at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:)
  37. Caused by: 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 'delect from testdb.test001 where id=9' at line
  38. at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:)
  39. at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:)
  40. at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:)
  41. at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:)
  42. at com.mysql.cj.jdbc.ClientPreparedStatement.execute(ClientPreparedStatement.java:)
  43. at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:)
  44. at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:)
  45. at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:)
  46. at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:)
  47. at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:)
  48. at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:)
  49. ... more

注意我的代码

  1. public interface UserMapper {
  2. //查询所有
  3. @Select("select * from testdb.test001")
  4. List<User> getUserList();
  5. @Select("select * from testdb.test001 where id=#{id}")
  6. User getUserById(@Param("id") int id);
  7. @Insert("insert into testdb.test001 (id,name) values (#{id},#{name})")
  8. int add(User user);
  9. @Update("update testdb.test001 set name=#{name} where id=#{id}")
  10. int updata(User user);
  11. @Delete("delect from testdb.test001 where id=#{id}")
  12. int delect(@Param("id") int id);
  13. }

delete拼错了

update拼错了

崩溃

 

以上就是报错--->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 'delect from testd的详细内容,更多关于报错--->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 'delect from testd的资料请关注九品源码其它相关文章!