datastore driver was not found in the CLASSPATH


Error Scenario:

The specified datastore driver (“com.mysql.jdbc.Driver”) was not found in the CLASSPATH

We usually get this error message while configuring Hive Local Metastore through MySQL database.

Root Cause:

If the JDBC driver JAR file for MySQL (Connector/J) is not on Hive’s classpath, ( in Hive’s lib directory – $HIVE_HOME/lib), we will get this error message.

Resolution:

We have to download this MySQL Connector/J jar file from MySQL downloads pages . For Ubuntu machines, platform independent version needs to be downloaded. Usually this file will be of format mysql-connector-java-X.Y.ZZ.tar.gz, where X.Y.ZZ denotes the version of the file.

  • This gzipped tarball file needs to be unpacked first.
  • Inside the folder mysql-connector-java-X.Y.ZZ , we can find  one jar file with name similar to mysql-connector-java-5.1.32-bin.jar.
  • This jar file needs to be copied into $HIVE_HOME/lib directory.

The commands needed for performing the above actions in Ubuntu, are given below.

After copying the jar files, now the issue is solved and hive service started without this error message and same is shown in below screen shot.

mysql tarball

Now the datastore driver was not found issue is resolved.


Profile photo of Siva

About Siva

Senior Hadoop developer with 4 years of experience in designing and architecture solutions for the Big Data domain and has been involved with several complex engagements. Technical strengths include Hadoop, YARN, Mapreduce, Hive, Sqoop, Flume, Pig, HBase, Phoenix, Oozie, Falcon, Kafka, Storm, Spark, MySQL and Java.

Leave a comment

Your email address will not be published. Required fields are marked *