Dataphin集成任务运行失败报错:"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 '00:00:00)' at line 1"

问题描述

Dataphin集成任务运行失败报错:"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 '00:00:00)' at line 1"。

2021-11-08 10:57:01.092 [0-0-0-reader] INFO  CommonRdbmsReader$Task - Begin to read record by Sql: [select create_time,finish_time from time_test where (create_time>=2021/11/07 00:00:00)]
2021-11-08 10:57:01.404 [0-0-0-reader] ERROR CommonRdbmsReader$Task - error occurred when reading.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 '00:00:00)' at line 1
 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_152]
 at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_152]
 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_152]
 at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_152]
 at com.mysql.jdbc.Util.handleNewInstance(Util.java:425) ~[mysql-connector-java-5.1.47.jar:5.1.47]
 at com.mysql.jdbc.Util.getInstance(Util.java:408) ~[mysql-connector-java-5.1.47.jar:5.1.47]
 at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:944) ~[mysql-connector-java-5.1.47.jar:5.1.47]
 at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3978) ~[mysql-connector-java-5.1.47.jar:5.1.47]
 at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3914) ~[mysql-connector-java-5.1.47.jar:5.1.47]
 at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2530) ~[mysql-connector-java-5.1.47.jar:5.1.47]
 at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2683) ~[mysql-connector-java-5.1.47.jar:5.1.47]
 at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2491) ~[mysql-connector-java-5.1.47.jar:5.1.47]
 at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2449) ~[mysql-connector-java-5.1.47.jar:5.1.47]
 at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1381) ~[mysql-connector-java-5.1.47.jar:5.1.47]
 at com.alibaba.datax.plugin.rdbms.util.DBUtil.query(DBUtil.java:460) ~[plugin-rdbms-util-0.0.1-SNAPSHOT.jar:na]
 at com.alibaba.datax.plugin.rdbms.util.DBUtil.query(DBUtil.java:447) ~[plugin-rdbms-util-0.0.1-SNAPSHOT.jar:na]
 at com.alibaba.datax.plugin.rdbms.util.DBUtil.query(DBUtil.java:426) ~[plugin-rdbms-util-0.0.1-SNAPSHOT.jar:na]
 at com.alibaba.datax.plugin.rdbms.reader.CommonRdbmsReader$Task.startRead(CommonRdbmsReader.java:209) ~[plugin-rdbms-util-0.0.1-SNAPSHOT.jar:na]
 at com.alibaba.datax.plugin.reader.mysqlreader.MysqlReader$Task.startRead(MysqlReader.java:82) [mysqlreader-0.0.1-SNAPSHOT.jar:na]
 at com.alibaba.dt.dlink.core.trans.adaptor.engine.ReaderRunnerAdaptor.run(ReaderRunnerAdaptor.java:57) [dlink-engine-0.0.1-SNAPSHOT.jar:na]
 at java.lang.Thread.run(Thread.java:882) [na:1.8.0_152]

问题原因

当时间参数有时、分、秒时需要加上单引号。

解决方案

如下配置,参数加上单引号即可。

适用于

  • Dataphin
阿里云首页 相关技术圈