Support Questions

Find answers, ask questions, and share your expertise

Hive Metastore database driver configuration

avatar
Rising Star

I am setting the Hive metastore db driver using:

ambari-server setup --jdbc-db=mysql --jdbc-driver=/usr/hdp/current/hive-server2/lib/mysql-connector-java-5.1.38.jar
Using python  /usr/bin/python
Setup ambari-server
.Copying /usr/hdp/current/hive-server2/lib/mysql-connector-java-5.1.38.jar to /var/lib/ambari-server/resources
If you are updating existing jdbc driver jar for mysql with mysql-connector-java-5.1.38.jar. Please remove the old driver jar, from all hosts. Restarting services that need the driver, will automatically copy the new jar to the hosts.
JDBC driver was successfully initialized.
Ambari Server 'setup' completed successfully.

and I have checked that the jar is in that path. But, when I try to restart Hiveserver2, I get the following error message:

2017-01-23 20:59:37,414 - Error! Sorry, but we can't find jdbc driver with default name mysql-connector-java.jar in hive lib dir. So, db connection check can fail. Please run 'ambari-server setup --jdbc-db={db_name} --jdbc-driver={path_to_jdbc} on server host.'
1 ACCEPTED SOLUTION

avatar
Expert Contributor

Confirm that mysql-connector-java.jar is in the Java share directory.

ls /usr/share/java/mysql-connector-java.jar

#under /usr/hdp/current/hive-server2/lib/

run the commands

cp mysql-connector-java-5.1.38.jar mysql-connector-java.jar

ambari-server setup --jdbc-db=mysql --jdbc-driver=/usr/hdp/current/hive-server2/lib/mysql-connector-java.jar

#then restart all services oh Hive

View solution in original post

3 REPLIES 3

avatar

Try point to the library provided by the system package as described in the docs?

https://docs.hortonworks.com/HDPDocuments/Ambari-2.4.2.0/bk_ambari-reference/content/using_hive_with...

avatar
Rising Star

I did, but it looks like the jar is not being automatically copeied on restart of Hive to other nodes

avatar
Expert Contributor

Confirm that mysql-connector-java.jar is in the Java share directory.

ls /usr/share/java/mysql-connector-java.jar

#under /usr/hdp/current/hive-server2/lib/

run the commands

cp mysql-connector-java-5.1.38.jar mysql-connector-java.jar

ambari-server setup --jdbc-db=mysql --jdbc-driver=/usr/hdp/current/hive-server2/lib/mysql-connector-java.jar

#then restart all services oh Hive