title: How to connect to hive using JDBC and HikariCP in spring batch project?
body: <p>I am trying to connect to hive jdbc using hikaricp (kerberos and keytab) in my spring batch project.</p>
  
  <p>following is my jdbcDataSource config.</p>
  
  <pre><code>@Bean(name = "hiveJdbcBatchDataSource")
  @Qualifier(value = "hiveJdbcBatchDataSource")
      public DataSource hiveJdbcBatchDataSource() throws Exception {
  
          try {
              HikariConfig config = new HikariConfig();
              config.setDriverClassName(driverClassName);
              config.setJdbcUrl(hiveUrl);
  
              System.setProperty("java.security.krb5.conf", krb5ConfPath);
              if (StringUtils.isNotBlank(keytabPath)) {
                  org.apache.hadoop.conf.Configuration conf = new org.apache.hadoop.conf.Configuration();
                  conf.set("hadoop.security.authentication", "kerberos");
                  UserGroupInformation.setConfiguration(conf);
                  UserGroupInformation.loginUserFromKeytab(principal, keytabPath);
              } else {
                  System.setProperty("javax.security.auth.useSubjectCredsOnly", "false");
                  config.setUsername(userName);
                  config.setPassword(password);
              }
  
              config.setConnectionTestQuery("show databases");
              config.addDataSourceProperty("zeroDateTimeBehavior", zeroDateTimeBehavior);
              config.addDataSourceProperty("cachePrepStmts", cachePrepStmts);
              config.addDataSourceProperty("prepStmtCacheSize", prepStmtCacheSize);
              config.addDataSourceProperty("prepStmtCacheSqlLimit", prepStmtCacheSqlLimit);
              // connection pooling
              config.setPoolName(poolName);
              config.setMaximumPoolSize(maximumPoolSize);
              config.setIdleTimeout(idleTimeoutMs);
              config.setMaxLifetime(maxLifetimeMs);
  
              return new HikariDataSource(config);
  
          } catch (IOException e) {
              throw new BeanInitializationException("IOException Failed to init data souce.", e);
          } catch (Exception e) {
              throw new Exception("Exception Failed to init data souce.", e);
          }
      }
  </code></pre>
  
  <p>I am getting following Exception</p>
  
  <pre><code>Caused by: org.springframework.batch.core.configuration.BatchConfigurationException: java.lang.IllegalArgumentException: DatabaseType not found for product name: [Apache Hive]
      at org.springframework.batch.core.configuration.annotation.DefaultBatchConfigurer.initialize(DefaultBatchConfigurer.java:119)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)
      at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:363)
      at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:307)
      at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:136)
      ... 16 common frames omitted
  Caused by: java.lang.IllegalArgumentException: DatabaseType not found for product name: [Apache Hive]
      at org.springframework.batch.support.DatabaseType.fromProductName(DatabaseType.java:84)
      at org.springframework.batch.support.DatabaseType.fromMetaData(DatabaseType.java:123)
      at org.springframework.batch.core.repository.support.JobRepositoryFactoryBean.afterPropertiesSet(JobRepositoryFactoryBean.java:183)
      at org.springframework.batch.core.configuration.annotation.DefaultBatchConfigurer.createJobRepository(DefaultBatchConfigurer.java:134)
      at org.springframework.batch.core.configuration.annotation.DefaultBatchConfigurer.initialize(DefaultBatchConfigurer.java:113)
      ... 23 common frames omitted
  </code></pre>
  
  <p>My pom contains following dependencies</p>
  
  <pre><code>        &lt;dependency&gt;
              &lt;groupId&gt;org.apache.hive&lt;/groupId&gt;
              &lt;artifactId&gt;hive-jdbc&lt;/artifactId&gt;
              &lt;version&gt;1.2.1&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.hadoop&lt;/groupId&gt;
              &lt;artifactId&gt;hadoop-common&lt;/artifactId&gt;
              &lt;version&gt;2.7.3&lt;/version&gt;
          &lt;/dependency&gt;
  </code></pre>
  
  <p>Note:
  I have tried to follow following answer but still getting the same exception</p>
  
  <p><a href="https://stackoverflow.com/questions/43241229/using-spring-batch-with-auto-configure-and-a-non-standard-database/43259482#43259482">Using Spring Batch with auto-configure and a non-standard database</a></p>