Support Questions
Find answers, ask questions, and share your expertise
Announcements
Check out our newest addition to the community, the Cloudera Innovation Accelerator group hub.

Could not load db driver class: net.sourceforge.jtds.jdbc.Driver

New Contributor

jTDS supports Windows Authentication, which is what I need.

1. I downloaded jTDS, put the jar file to my directory /opt/data/xxxx

2. I ran

sqoop list-tables -libjars "/opt/data/xxxxxx/jtds-1.3.1.jar" \ --driver "net.sourceforge.jtds.jdbc.Driver" \ --connect "jdbc:jtds:sqlserver://xxx.xxx.xxx.xxx\yyyy;domain=ad" \ --username xxxxxx \ --password 'xxxxxx'

3. Error:

......

16/05/25 19:11:15 ERROR sqoop.Sqoop: Got exception running Sqoop: java.lang.RuntimeException: Could not load db driver class: net.sourceforge.jtds.jdbc.Driver java.lang.RuntimeException: Could not load db driver class: net.sourceforge.jtds.jdbc.Driver at org.apache.sqoop.manager.SqlManager.makeConnection(SqlManager.java:848) at org.apache.sqoop.manager.GenericJdbcManager.getConnection(GenericJdbcManager.java:52) at org.apache.sqoop.manager.SqlManager.listTables(SqlManager.java:517) at org.apache.sqoop.tool.ListTablesTool.run(ListTablesTool.java:49) at org.apache.sqoop.Sqoop.run(Sqoop.java:148) at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70) at org.apache.sqoop.Sqoop.runSqoop(Sqoop.java:184) at org.apache.sqoop.Sqoop.runTool(Sqoop.java:226) at org.apache.sqoop.Sqoop.runTool(Sqoop.java:235) at org.apache.sqoop.Sqoop.main(Sqoop.java:244)

4. Java version

$ java -version java version "1.7.0_85" OpenJDK Runtime Environment (rhel-2.6.1.3.el6_7-x86_64 u85-b01) OpenJDK 64-Bit Server VM (build 24.85-b03, mixed mode)

5. jar file check

]$ jar tf jtds-1.3.1.jar META-INF/ META-INF/MANIFEST.MF META-INF/services/ net/ net/sourceforge/ net/sourceforge/jtds/ net/sourceforge/jtds/jdbc/ net/sourceforge/jtds/jdbc/cache/ net/sourceforge/jtds/jdbcx/ net/sourceforge/jtds/jdbcx/proxy/ net/sourceforge/jtds/ssl/ net/sourceforge/jtds/util/ META-INF/services/java.sql.Driver net/sourceforge/jtds/jdbc/BlobImpl.class net/sourceforge/jtds/jdbc/CachedResultSet.class net/sourceforge/jtds/jdbc/CharsetInfo$1.class net/sourceforge/jtds/jdbc/CharsetInfo.class net/sourceforge/jtds/jdbc/Charsets.properties net/sourceforge/jtds/jdbc/ClobImpl.class net/sourceforge/jtds/jdbc/ColInfo.class net/sourceforge/jtds/jdbc/DateTime.class net/sourceforge/jtds/jdbc/DefaultProperties.class net/sourceforge/jtds/jdbc/Driver.class ......

Any idea of the failure?

Thanks a lot!

1 ACCEPTED SOLUTION

Guru

If you are using Sandbox or HDP, try copying the jar to /usr/hdp/<version>/sqoop/lib/

Let us know once you test with jtds how jtds works.

View solution in original post

2 REPLIES 2

Guru

If you are using Sandbox or HDP, try copying the jar to /usr/hdp/<version>/sqoop/lib/

Let us know once you test with jtds how jtds works.

New Contributor

Ravi, Thank you so much!

It works. A few things I have observed:

1. In connect string, instance needs to be separated from server.

sqoop list-tables -libjars "/usr/hdp/2.2.8.0-3150/sqoop/lib/jtds-1.3.1.jar" --driver "net.sourceforge.jtds.jdbc.Driver" --connect "jdbc:jtds:sqlserver://xxx.xxx.xxx.xxx;instance=yyyy;databaseName=zzzz;domain=ad" --username xxxxxx --password 'xxxxxx'

is the correct format

2. list-tables only list physical tables. Views are not listed

3. When import from MS SQL Server to Hive table. Data type may be changed by default. I see date/datetime is changed to string, bit is changed to boolean.

Overall, it works very well.