Support Questions
Find answers, ask questions, and share your expertise

,how to setup jdbc driver jars for a hive client - hdp 2.5?

,how to setup jdbc driver jars for a hive client - hdp 2.5?

New Contributor


Tried adding all possible jars ( hive-jdbc,hive-service,hadoop-common, hadoop-auth, log4j,slf4j etc) but getting the following exception :

but when use the jdbc-uber jar from here:

it works fine.trying to use the standard jars.any suggestions would be appreciated.

p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Menlo} span.s1 {font-variant-ligatures: no-common-ligatures} span.Apple-tab-span {white-space:pre}

Reported exception:

javax.xml.parsers.FactoryConfigurationError: Provider for class javax.xml.parsers.SAXParserFactory cannot be created

at javax.xml.parsers.FactoryFinder.findServiceProvider(

at javax.xml.parsers.FactoryFinder.find(

at javax.xml.parsers.SAXParserFactory.newInstance(

at ch.qos.logback.core.joran.event.SaxEventRecorder.buildSaxParser(

at ch.qos.logback.core.joran.event.SaxEventRecorder.recordEvents(

at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(

at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(

at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(

at ch.qos.logback.classic.util.ContextInitializer.configureByResource(

at ch.qos.logback.classic.util.ContextInitializer.autoConfig(

at org.slf4j.impl.StaticLoggerBinder.init(

at org.slf4j.impl.StaticLoggerBinder.<clinit>(

at org.slf4j.LoggerFactory.bind(

at org.slf4j.LoggerFactory.performInitialization(

at org.slf4j.LoggerFactory.getILoggerFactory(

at org.slf4j.LoggerFactory.getLogger(

at org.slf4j.LoggerFactory.getLogger(

at org.apache.activemq.jms.pool.PooledConnectionFactory.<clinit>(

Caused by: java.util.ServiceConfigurationError: javax.xml.parsers.SAXParserFactory: Provider org.apache.xerces.jaxp.SAXParserFactoryImpl not found


at java.util.ServiceLoader.access$300(

at java.util.ServiceLoader$LazyIterator.nextService(

at java.util.ServiceLoader$

at java.util.ServiceLoader$

at javax.xml.parsers.FactoryFinder$

at Method)

at javax.xml.parsers.FactoryFinder.findServiceProvider(

... 26 more


Re: ,how to setup jdbc driver jars for a hive client - hdp 2.5?

Expert Contributor

Please try to add the below jar :


[root@ambari-slave1 ~]# find /usr/hdp -name xercesImpl.jar
[root@ambari-slave1 ~]# /usr/jdk64/jdk1.8.0_77/bin/jar -tvf /usr/hdp/ | grep -i SAXParserFactoryImp
  2701 Fri Sep 14 18:26:18 UTC 2007 org/apache/xerces/jaxp/SAXParserFactoryImpl.class
[root@ambari-slave1 ~]#

Re: ,how to setup jdbc driver jars for a hive client - hdp 2.5?

@Mohit Nagrath

If you are trying to write a simple client, then these jars should be enough for you to work with:

Here is a simple JDBC client app that describes a table.

import java.sql.SQLException;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.sql.DriverManager;
public class myClient {
  private static String driverName = "org.apache.hive.jdbc.HiveDriver";
   * @param args
   * @throws SQLException
  public static void main(String[] args) throws SQLException {
      try {
    } catch (ClassNotFoundException e) {
      // TODO Auto-generated catch block
    //replace "hive" here with the name of the user the queries should run as
    Connection con = DriverManager.getConnection("jdbc:hive2://localhost:10000/default", "hive", "");
    Statement stmt = con.createStatement();
    String tableName = "testHiveDriverTable";
    stmt.execute("drop table if exists " + tableName);
    stmt.execute("create table " + tableName + " (key int, value string)");
    // show tables
    String sql = "show tables '" + tableName + "'";
    System.out.println("Running: " + sql);
    ResultSet res = stmt.executeQuery(sql);
    if ( {
       // describe table
    sql = "describe " + tableName;
    System.out.println("Running: " + sql);
    res = stmt.executeQuery(sql);
    while ( {
      System.out.println(res.getString(1) + "\t" + res.getString(2));

Compiled using the following jars:

javac -cp /usr/hdp/

Executed using the same jars:

java -cp /usr/hdp/  myClient
Dec 29, 2016 9:40:29 PM org.apache.hive.jdbc.Utils parseURL
INFO: Supplied authorities: localhost:10000
Dec 29, 2016 9:40:29 PM org.apache.hive.jdbc.Utils parseURL
INFO: Resolved authority: localhost:10000
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See for further details.
Running: show tables 'testHiveDriverTable'
Running: describe testHiveDriverTable
key	int
value	string

Re: ,how to setup jdbc driver jars for a hive client - hdp 2.5?


I am using HDP 2.3

I am able to fetch data from hive to resultSet through JDBC

javac -cp /usr/hdp/ 
java -cp /usr/hdp/  hive_connection

but problem is in delete and update :

Caused by: org.apache.hive.service.cli.HiveSQLException: Error while compiling statement: FAILED: SemanticException [Error 10294]: Attempt to do update or delete using transaction manager that does not support these operations.

table is ORC and i am able to delete data through hive shell but through java jdbc it showing above error

delete from mpm_txt_ppp_xxx_history_orc_del where kmmrercd=10001204

Re: ,how to setup jdbc driver jars for a hive client - hdp 2.5?

New Contributor

Thanks for your response.There is a small issue that is seen with the simple jdbc client. when i run the count query on a hive table using my jdbc client i am seeing different numbers being returned vs when i am running the same count query from hive-cli or other means.Any such known issues that have been seen before?

Re: ,how to setup jdbc driver jars for a hive client - hdp 2.5?


There should be no difference in either outputs. Can you share the query ?