Support Questions

Find answers, ask questions, and share your expertise
Check out our newest addition to the community, the Cloudera Data Analytics (CDA) group hub.

-libjar option is not working in sqoop import for sqoop version 1.4.6

New Contributor

 sqoop import   -libjars /app/hadoop_users/Mahfooz/sqoop/mysql-connector-java-5.1.48.jar   --connect "jdbc:mysql://"   --username "root"   --password "root"   --table cities   --fields-terminated-by ","   --hive-import   --create-hive-table   --hive-table test.cities_mysql   --   --schema "move"
Warning: /app/cloudera/parcels/CDH-5.16.1-1.cdh5.16.1.p0.3/bin/../lib/sqoop/../accumulo does not exist! Accumulo imports will fail.
Please set $ACCUMULO_HOME to the root of your Accumulo installation.
20/03/29 03:07:51 INFO sqoop.Sqoop: Running Sqoop version: 1.4.6-cdh5.16.1
20/03/29 03:07:52 WARN tool.BaseSqoopTool: Setting your password on the command-line is insecure. Consider using -P instead.
20/03/29 03:07:52 INFO manager.MySQLManager: Preparing to use a MySQL streaming resultset.
20/03/29 03:07:52 INFO tool.CodeGenTool: Beginning code generation
20/03/29 03:07:52 ERROR sqoop.Sqoop: Got exception running Sqoop: java.lang.RuntimeException: Could not load db driver class: com.mysql.jdbc.Driver
java.lang.RuntimeException: Could not load db driver class: com.mysql.jdbc.Driver
        at org.apache.sqoop.manager.SqlManager.makeConnection(
        at org.apache.sqoop.manager.GenericJdbcManager.getConnection(
        at org.apache.sqoop.manager.SqlManager.execute(
        at org.apache.sqoop.manager.SqlManager.execute(
        at org.apache.sqoop.manager.SqlManager.getColumnInfoForRawQuery(
        at org.apache.sqoop.manager.SqlManager.getColumnTypesForRawQuery(
        at org.apache.sqoop.manager.SqlManager.getColumnTypes(
        at org.apache.sqoop.manager.ConnManager.getColumnTypes(
        at org.apache.sqoop.orm.ClassWriter.getColumnTypes(
        at org.apache.sqoop.orm.ClassWriter.generate(
        at org.apache.sqoop.tool.CodeGenTool.generateORM(
        at org.apache.sqoop.tool.ImportTool.importTable(
        at org.apache.sqoop.Sqoop.runSqoop(
        at org.apache.sqoop.Sqoop.runTool(
        at org.apache.sqoop.Sqoop.runTool(
        at org.apache.sqoop.Sqoop.main(


@mahfooz  The mysql jar should be in the class path for the sqoop client.  Also make sure the file ha the correct permissions.

New Contributor

Yes, by adding jar in classpath, i am able to import without using -libjars option also as given below.


export HADOOP_CLASSPATH=/app/hadoop_users/Mahfooz/sqoop/mysql-connector-java-5.1.48.jar
sqoop import \
  --connect "jdbc:mysql://localhost:3306/move?verifyServerCertificate=false&zeroDateTimeBehavior=round" \
  --username "something" \
  --password "something" \
  --delete-target-dir \
  --table users \
  --fields-terminated-by "," \
  --hive-import \
  --create-hive-table \
  --hive-table test.users \
  -- \
  --schema "move"



But what is the use of this -libjars option. I am still confused.

Take a Tour of the Community
Don't have an account?
Your experience may be limited. Sign in to explore more.