SQOOP SQLSERVER Failed to load driver “ appropriate connection manager is not being set”

后端 未结 4 801
夕颜
夕颜 2021-02-14 11:05

I downloaded sqljdbc4.jar. I\'m invoking sqoop like so from the folder (where the jar is stored):

sqoop list-tables --driver com.microso

相关标签:
4条回答
  • 2021-02-14 11:19

    According to this sqoop documentation, generic options like -libjars must come before tool-specific options:

    Generic Hadoop command-line arguments:
    (must preceed any tool-specific arguments)
    ...
    -libjars <comma separated list of jars> specify comma separated jar files to include in the classpath.

    0 讨论(0)
  • 2021-02-14 11:21

    You need to put sqljdbc4.jar in $SQOOP_HOME/lib and also add sqoop-1.4.4.jar or whatever version you are using along with sqljdbc4.jar to $HADOOP_HOME/lib.

    I'm using Hadoop-2.2.0, so i put it inside $HADOOP_HOME/share/hadoop/common/lib directory, and use the following command to do the import:

    export HCAT_HOME=/home/Kuntal/BIG_DATA/hive-0.12.0/hcatalog

    (sometimes HCatlog of Hive needs to be exported or set.)

    ./sqoop-import --connect "jdbc:sqlserver://IP\INSTANCE;port=1433;username=USERNAME;password=PASSWORD;database=DATABASE_NAME" --table TABLE_NAME --target-dir hdfs://localhost:50315/sqoop --m 1

    Sometimes you have to specify the port, otherwise default works. Hope you find it useful.

    0 讨论(0)
  • 2021-02-14 11:24

    Recently came across this same problem. Even though documentation says that it will pick up additional jar files. The problem is I believe propagated from Hadoop jar command line option. -libjars is not reliable option to set additional jar file path. Instead, choose HADOOP_CLASSPATH option to setup additional jar files.

    In my case, I had multiple different versions of driver JAR, but using -libjars was not correctly picking up file for me.

    To resolve this, I specified

    export HADOOP_CLASSPATH=/$SQOOP_HOME/<path_to_driver>.jar
    

    This makes sure that correct JAR file gets loaded.

    0 讨论(0)
  • 2021-02-14 11:42

    In vast majority of cases using parameter --driver is not required and even more will lead to an undesirable behaviour. I would strongly recommend dropping this argument entirely from your command line. Check out Connectors vs Drivers blog post for more details.

    Also in addition you are specifying a nonexistent JDBC Driver class. The correct one is:

    com.microsoft.sqlserver.jdbc.SQLServerDriver
    

    You can see it in the official docs, whereas you are specifying

    com.microsoft.jdbc.sqlserver.SQLServerDriver
    

    Notice the different order of jdbc and sqlserver packages. This is one of the reasons why it's recommended to not use the --driver option at all.

    0 讨论(0)
提交回复
热议问题