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 'WHERE id=110' at line 1 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_201] at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) ~[na:1.8.0_201] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) ~[na:1.8.0_201] at java.lang.reflect.Constructor.newInstance(Unknown Source) ~[na:1.8.0_201] at com.mysql.jdbc.Util.handleNewInstance(Util.java:425) ~[mysql-connector-java-5.1.40.jar:5.1.40] at com.mysql.jdbc.Util.getInstance(Util.java:408) ~[mysql-connector-java-5.1.40.jar:5.1.40] at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:943) ~[mysql-connector-java-5.1.40.jar:5.1.40] at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3970) ~[mysql-connector-java-5.1.40.jar:5.1.40] at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3906) ~[mysql-connector-java-5.1.40.jar:5.1.40] at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2524) ~[mysql-connector-java-5.1.40.jar:5.1.40] at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2677) ~[mysql-connector-java-5.1.40.jar:5.1.40] at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2549) ~[mysql-connector-java-5.1.40.jar:5.1.40] at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1861) ~[mysql-connector-java-5.1.40.jar:5.1.40] at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1192) ~[mysql-connector-java-5.1.40.jar:5.1.40] at com.alibaba.druid.pool.DruidPooledPreparedStatement.execute(DruidPooledPreparedStatement.java:498) ~[druid-1.1.9.jar:1.1.9] at com.alibaba.otter.canal.client.adapter.rdb.support.BatchExecutor.execute(BatchExecutor.java:62) ~[client-adapter.rdb-1.1.2-jar-with-dependencies.jar:na] at com.alibaba.otter.canal.client.adapter.rdb.service.RdbSyncService.update(RdbSyncService.java:252) [client-adapter.rdb-1.1.2-jar-with-dependencies.jar:na] at com.alibaba.otter.canal.client.adapter.rdb.service.RdbSyncService.sync(RdbSyncService.java:133) [client-adapter.rdb-1.1.2-jar-with-dependencies.jar:na] at com.alibaba.otter.canal.client.adapter.rdb.service.RdbSyncService.lambda$null$2(RdbSyncService.java:104) [client-adapter.rdb-1.1.2-jar-with-dependencies.jar:na] at java.util.ArrayList.forEach(Unknown Source) ~[na:1.8.0_201] at com.alibaba.otter.canal.client.adapter.rdb.service.RdbSyncService.lambda$sync$3(RdbSyncService.java:104) [client-adapter.rdb-1.1.2-jar-with-dependencies.jar:na] at java.util.concurrent.FutureTask.run(Unknown Source) ~[na:1.8.0_201] at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) ~[na:1.8.0_201] at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) ~[na:1.8.0_201] at java.lang.Thread.run(Unknown Source) ~[na:1.8.0_201]
2019-02-16 02:49:53.598 TRACE 15752 --- [pool-4-thread-1] c.a.o.c.c.a.rdb.service.RdbSyncService : Update target table, sql: UPDATE oa3.vus_authority SE WHERE id=? 2019-02-16 02:49:53.607 DEBUG 15752 --- [pool-4-thread-1] c.a.o.c.c.a.rdb.service.RdbSyncService : DML: {"data":{"id":110,"name_key":"coupon_issue_operate","name":"浼樻儬鍒稿彂甯?,"sort_index":2,"pre_id":104,"enable":1,"update_time":1550256593000,"auth_type":2,"sys_type":2,"create_time":1547020397000,"user_id":323232},"database":"oa2","destination":"example","old":{"update_time":1547020397000,"user_id":null},"table":"vus_authority","type":"UPDATE"}
2019-02-16 02:49:53.612 TRACE 15752 --- [pool-4-thread-1] c.a.o.c.c.a.rdb.support.BatchExecutor : Batch executor: 1 commit 0 rows
重点是: Update target table, sql: UPDATE oa3.vus_authority SE WHERE id=? 这么明显的错误
原提问者GitHub用户weir2010
根据你提供的错误信息,是一个MySQL的语法错误。具体来说,在执行SQL语句时,发现了一个语法错误,导致执行失败。根据错误信息,可以看到错误的SQL语句是类似于以下形式:
UPDATE tablename WHERE id=110
这条语句的问题在于缺少SET
关键字,应该写成:
UPDATE tablename SET column=value WHERE id=110
其中,tablename
是要更新的表名,column
是要更新的列名,value
是要更新的值,id
是更新的条件。你需要根据具体情况修改对应的表名、列名、值和条件。
你可以检查一下你的代码,查看是否有类似于上述错误的SQL语句,找到问题所在并进行修改即可。
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。