Reputation: 31546
I executed this simple command from sqoop against mysql database (4.1.22-standard-log)
sqoop import --connect jdbc:mysql://test.ddc:3306/test --table "foo" --username test --password bar --hive-table test.foo --as-avrodatafile --target-dir /user/admin/foo
I have copied mysql-connector-java-5.1.31-bin.jar
to /opt/cloudera/parcels/CDH-5.4.1-1.cdh5.4.1.p0.6/lib/sqoop/lib/
I got this error
16/03/08 21:55:56 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM `accessory` AS t LIMIT 1
16/03/08 21:55:56 ERROR manager.CatalogQueryManager: Failed to list columns from query: SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = (SELECT SCHEMA()) AND TABLE_NAME = 'foo'
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 '()) AND TABLE_NAME = 'foo'' at line 1
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:408)
at com.mysql.jdbc.Util.getInstance(Util.java:383)
Upvotes: 0
Views: 713
Reputation: 31546
I was able to solve this. The driver parameter was missing above and that was causing the issue. the command below worked
sqoop import --connect jdbc:mysql://test.ddc:3306/test --table "foo" --driver
com.mysql.jdbc.Driver --username test --password bar --hive-table test.foo --
as-avrodatafile --target-dir /user/admin/foo
Upvotes: 1