首页 > 代码库 > Sqoop:Could not load db driver class: com.microsoft.sqlserver.jdbc.SQLServerDriver

Sqoop:Could not load db driver class: com.microsoft.sqlserver.jdbc.SQLServerDriver

Sqoop version:1.4.6-cdh

Hadoop version:2.6.0-cdh5.8.2

场景:使用Sqoop从MSSqlserver导数据

虽然1.4.6的官网说

Even if Sqoop supports a database internally, you may still need to install the database vendor’s JDBC driver in your $SQOOP_HOME/lib path on your client. Sqoop can load classes from any jars in $SQOOP_HOME/lib on the client and will use them as part of any MapReduce jobs it runs; unlike older versions, you no longer need to install JDBC jars in the Hadoop library path on your servers.

我已经把sqljdbc4.jar放到了$SQOOP_HOME/lib下面,但是仍然会报出错误

ERROR sqoop.Sqoop: Got exception running Sqoop: java.lang.RuntimeException: 
  Could not load db driver class: com.microsoft.sqlserver.jdbc.SQLServerDriverjava.lang.RuntimeException: Could not load db driver class: com.microsoft.sqlserver.jdbc.SQLServerDriver

尝试着放到 $HADOOP_HOME/lib 下面,仍然不起作用;

最后放到 $HADOOP_HOME/share/hadoop/common/lib 下面OK了。

 

Sqoop:Could not load db driver class: com.microsoft.sqlserver.jdbc.SQLServerDriver