FAQ
I'm trying to import data using sqoop command

% sqoop import --connect jdbc:mysql://localhost/hadoopguide --table widgets
-m 1

but i get the following error.

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 com.cloudera.sqoop.manager.SqlManager.makeConnection(SqlManager.java:597)
at com.cloudera.sqoop.manager.GenericJdbcManager.getConnection(GenericJdbcManager.java:51)
at com.cloudera.sqoop.manager.MySQLManager.execute(MySQLManager.java:201)
at com.cloudera.sqoop.manager.SqlManager.getColumnTypesForRawQuery(SqlManager.java:177)
at com.cloudera.sqoop.manager.SqlManager.getColumnTypes(SqlManager.java:161)
at com.cloudera.sqoop.orm.ClassWriter.generate(ClassWriter.java:908)
at com.cloudera.sqoop.tool.CodeGenTool.generateORM(CodeGenTool.java:82)
at com.cloudera.sqoop.tool.ImportTool.importTable(ImportTool.java:337)
at com.cloudera.sqoop.tool.ImportTool.run(ImportTool.java:423)
at com.cloudera.sqoop.Sqoop.run(Sqoop.java:144)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:65)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:79)
at com.cloudera.sqoop.Sqoop.runSqoop(Sqoop.java:180)
at com.cloudera.sqoop.Sqoop.runTool(Sqoop.java:218)
at com.cloudera.sqoop.Sqoop.main(Sqoop.java:228)

Search Discussions

  • Romain Rigaux at Oct 5, 2012 at 6:18 am
    Hi,

    You need to add the MySql connector (e.g.
    http://www.mysql.com/downloads/connector/j/) to /usr/lib/sqoop/lib.

    Romain

    http://archive.cloudera.com/cdh4/cdh/4/sqoop/SqoopUserGuide.html#_connecting_to_a_database_server

    You can use Sqoop with any other JDBC-compliant database. First, download
    the appropriate JDBC driver for the type of database you want to import,
    and install the .jar file in the $SQOOP_HOME/lib directory on your client
    machine. (This will be /usr/lib/sqoop/lib if you installed from an RPM or
    Debian package.) Each driver .jar file also has a specific driver class
    which defines the entry-point to the driver. For example, MySQL’s
    Connector/J library has a driver class of com.mysql.jdbc.Driver. Refer to
    your database vendor-specific documentation to determine the main driver
    class. This class must be provided as an argument to Sqoop with --driver.

    For example, to connect to a SQLServer database, first download the driver
    from microsoft.com and install it in your Sqoop lib path.

    Then run Sqoop. For example:

    $ sqoop import --driver com.microsoft.jdbc.sqlserver.SQLServerDriver \
    --connect <connect-string> ...






    On Thu, Oct 4, 2012 at 10:31 PM, umer khayam wrote:

    I'm trying to import data using sqoop command

    % sqoop import --connect jdbc:mysql://localhost/hadoopguide --table
    widgets -m 1

    but i get the following error.

    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 com.cloudera.sqoop.manager.SqlManager.makeConnection(SqlManager.java:597)
    at com.cloudera.sqoop.manager.GenericJdbcManager.getConnection(GenericJdbcManager.java:51)
    at com.cloudera.sqoop.manager.MySQLManager.execute(MySQLManager.java:201)
    at com.cloudera.sqoop.manager.SqlManager.getColumnTypesForRawQuery(SqlManager.java:177)
    at com.cloudera.sqoop.manager.SqlManager.getColumnTypes(SqlManager.java:161)
    at com.cloudera.sqoop.orm.ClassWriter.generate(ClassWriter.java:908)
    at com.cloudera.sqoop.tool.CodeGenTool.generateORM(CodeGenTool.java:82)
    at com.cloudera.sqoop.tool.ImportTool.importTable(ImportTool.java:337)
    at com.cloudera.sqoop.tool.ImportTool.run(ImportTool.java:423)
    at com.cloudera.sqoop.Sqoop.run(Sqoop.java:144)
    at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:65)
    at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:79)
    at com.cloudera.sqoop.Sqoop.runSqoop(Sqoop.java:180)
    at com.cloudera.sqoop.Sqoop.runTool(Sqoop.java:218)
    at com.cloudera.sqoop.Sqoop.main(Sqoop.java:228)

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouphue-user @
categorieshadoop
postedOct 5, '12 at 5:31a
activeOct 5, '12 at 6:18a
posts2
users2
websitecloudera.com
irc#hadoop

2 users in discussion

Umer khayam: 1 post Romain Rigaux: 1 post

People

Translate

site design / logo © 2022 Grokbase