开发者社区> 问答> 正文

RDB 同步错误

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

展开
收起
古拉古拉 2023-05-08 14:22:33 77 0
2 条回答
写回答
取消 提交回答
  • 最新代码已解决

    原回答者GitHub用户rewerma

    2023-05-09 17:57:10
    赞同 展开评论 打赏
  • 根据你提供的错误信息,是一个MySQL的语法错误。具体来说,在执行SQL语句时,发现了一个语法错误,导致执行失败。根据错误信息,可以看到错误的SQL语句是类似于以下形式:

    UPDATE tablename WHERE id=110
    

    这条语句的问题在于缺少SET关键字,应该写成:

    UPDATE tablename SET column=value WHERE id=110
    

    其中,tablename是要更新的表名,column是要更新的列名,value是要更新的值,id是更新的条件。你需要根据具体情况修改对应的表名、列名、值和条件。

    你可以检查一下你的代码,查看是否有类似于上述错误的SQL语句,找到问题所在并进行修改即可。

    2023-05-08 15:39:46
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载