Sqoop1.99.7通过Java客户端api创建MySQL导入到HDFS文件系统。
Job调用时报如下错误:
org.apache.sqoop.common.SqoopException: GENERIC_JDBC_CONNECTOR_0016:Can't fetch schema
Caused by: 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 '"database_name"."table_name"' at line 1
原因是配置MySQL数据连接时没有配置 双引号 (") 字符转义,
解决办法:在Java代码里面加入如下配置
fromLink.getConnectorLinkConfig("dialect").getStringInput("dialect.identifierEnclose").setValue(" ");//将"转义为空格
网友评论