Sqoop:无法加载 mysql 驱动程序异常

Sqoop: Could not load mysql driver exception(Sqoop:无法加载 mysql 驱动程序异常)

本文介绍了Sqoop:无法加载 mysql 驱动程序异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在本地机器上安装了 Sqoop.以下是配置信息.

I Installed Sqoop in my local machine. Following are the config information.

Bash.bashrc:

Bash.bashrc:

export HADOOP_HOME=/home/hduser/hadoop
export HBASE_HOME=/home/hduser/hbase
export HIVE_HOME=/home/hduser/hive
export HCAT_HOME=/home/hduser/hive/hcatalog
export SQOOP_HOME=/home/hduser/sqoop

export PATH=$PATH:$HIVE_HOME/bin
export PATH=$PATH:$HADOOP_HOME/bin
export PATH=$PATH:$HBASE_HOME/bin
export PATH=$PATH:$SQOOP_HOME/bin
export PATH=$PATH:$HCAT_HOME/bin

Hadoop:

Version: Hadoop 1.0.3

蜂巢:

Version: hive 0.11.0 

Mysql 连接器驱动

Mysql Connector driver

version: mysql-connector-java-5.1.29

"The driver is copied to the lib folder of sqoop"

Sqoop:

version: sqoop 1.4.4

完成所有安装后,我在 mysql 中创建了一个名为 practice_1 的表,但是当我运行 load 命令将数据从 mysql 加载到 hdfs 时,该命令抛出异常:

After making all the installation I create a table in mysql named practice_1, But when I run the load command to load data from mysql to hdfs the command throws an exception:

ERROR sqoop.Sqoop: Got exception running Sqoop: java.lang.RuntimeException: Could not     load db driver class: com.mysql.jdbc.Driver

请任何人指导我可能出现的问题.

Coud anyone please guide me what can be the possible problem.

推荐答案

You need database driver in 'SQOOP' classpath check 这个它对SQOOP"有很好的解释

You need database driver in 'SQOOP' classpath check this It has wonderful explanation about the 'SQOOP'

SQOOP 有其他选项,例如

SQOOP has other options like

例如:--driver com.microsoft.jdbc.sqlserver.SQLServerDriver -libjars=".*jar"

Ex: --driver com.microsoft.jdbc.sqlserver.SQLServerDriver -libjars=".*jar"

来自这里

您可以将 Sqoop 与任何其他符合 JDBC 的数据库一起使用.首先,为要导入的数据库类型下载相应的 JDBC 驱动程序,然后在客户端计算机的 $SQOOP_HOME/lib 目录中安装 .jar 文件.(如果您是从 RPM 或 Debian 包安装的,这将是/usr/lib/sqoop/lib.)每个驱动程序 .jar 文件还有一个特定的驱动程序类,它定义了驱动程序的入口点.例如,MySQL 的 Connector/J 库有一个驱动程序类 com.mysql.jdbc.Driver.请参阅特定于数据库供应商的文档以确定主要驱动程序类.必须使用 --driver 将此类作为参数提供给 Sqoop.

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.

您可能有兴趣了解连接器和驱动程序之间的区别这里是文章

You may be interested in understanding the difference between connector and driver here is the article

这篇关于Sqoop:无法加载 mysql 驱动程序异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:Sqoop:无法加载 mysql 驱动程序异常

基础教程推荐