Sqoop:无法加载mysql驱动程序异常 [英] Sqoop: Could not load mysql driver exception
问题描述
我在本地机器上安装了Sqoop。以下是配置信息。
Bash.bashrc:
导出HADOOP_HOME = / home / hduser / hadoop
$ Hadoop:
export HBASE_HOME = / home / hduser / hbase
export HIVE_HOME = / home / hduser / hive
export HCAT_HOME = / home / hduser / hive / hcatalog
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 1.0.3
Hive:
版本:hive 0.11.0
Mysql连接器驱动程序
版本:mysql-connector-java-5.1.29
驱动程序被复制到sqoop的lib文件夹
Sqoop:
版本:sqoop 1.4.4
After使所有安装我创建一个名为practice_1的mysql表,但是当我运行load命令从mysql加载数据到hdfs时,该命令会引发一个异常:
错误sqoop.Sqoop:运行Sqoop异常:java.lang.RuntimeException:无法加载数据库驱动程序类:com.mysql.jdbc.Driver
任何人都请指导我可能会出现什么问题。
解决方案您需要在'SQOOP'类路径检查中使用数据库驱动程序
它有关于'SQOOP'的精彩解释
SQOOP有其他选项,如$ / b
$ b
例如:--driver com.microsoft.jdbc.sqlserver.SQLServerDriver -libjars =。* jar
源自 here
您可以将Sqoop与任何其他JDBC兼容的数据库一起使用。首先,为要导入的数据库类型下载相应的JDBC驱动程序,然后将.jar文件安装到客户机上的$ SQOOP_HOME / lib目录中。 (如果您是从RPM或Debian软件包安装的,这将是/ usr / lib / sqoop / lib)。每个驱动程序.jar文件也有一个特定的驱动程序类,它定义了驱动程序的入口点。例如,MySQL的Connector / J库有一个com.mysql.jdbc.Driver驱动程序类。请参阅您的数据库供应商特定的文档以确定主要的驱动程序类。这个类必须作为Sqoop的参数提供--driver。
您可能有兴趣了解连接器和驱动程序之间的区别此处是文章
I Installed Sqoop in my local machine. Following are the config information.
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
Hive:
Version: hive 0.11.0
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
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 this It has wonderful explanation about the 'SQOOP'
SQOOP has other options like
Ex: --driver com.microsoft.jdbc.sqlserver.SQLServerDriver -libjars=".*jar"
from here
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驱动程序异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!