1

Hive Metastore is not creating MYSQL or Derby Connection.

For Derby

schematool -dbType derby -initSchema
Metastore connection URL:    jdbc:mysql://localhost/metastore
Metastore Connection Driver :    com.mysql.jdbc.Driver
Metastore connection User:   hive

schematool -dbType derby -info
Metastore connection URL:    jdbc:mysql://localhost/metastore
Metastore Connection Driver :    com.mysql.jdbc.Driver
Metastore connection User:   hive
org.apache.hadoop.hive.metastore.HiveMetaException: Failed to load driver
*** schemaTool failed ***

For mysql

schematool -dbType mysql -initSchema
Metastore connection URL:    jdbc:mysql://localhost/metastore
Metastore Connection Driver :    com.mysql.jdbc.Driver
Metastore connection User:   hive
org.apache.hadoop.hive.metastore.HiveMetaException: Failed to load driver
*** schemaTool failed ***

schematool -dbType mysql -info
Metastore connection URL:    jdbc:mysql://localhost/metastore
Metastore Connection Driver :    com.mysql.jdbc.Driver
Metastore connection User:   hive
org.apache.hadoop.hive.metastore.HiveMetaException: Failed to load driver
*** schemaTool failed ***

What is the issue .

I am running Hive 0.12.0

USB
  • 6,019
  • 15
  • 62
  • 93

4 Answers4

3

I think the problem is with your URL. Modify the URL as follows. Put the mysql port no.

Metastore connection URL: jdbc:mysql://localhost:3306/metastore

buddy86
  • 1,434
  • 12
  • 20
  • I am trying to configure mysql with hive from a very very long time, Everytime I encounter errors I don't understand where I am going wrong ..... as you can see in this link https://gist.github.com/anonymous/bb86629116891e5b2d8c30b95aca9aee hive-site.xml configuration can be seen here in the link https://gist.github.com/anonymous/44f1c9fc214136a113067cf3b4b72794 Here is file-structure https://gist.github.com/anonymous/e02b3631da940dfae880252ca72107de – KJ_kaka Apr 09 '16 at 16:46
1

If you want to access Derby, I suspect these should be something like:

Metastore connection URL:    jdbc:derby://localhost:1527/metastore
Metastore Connection Driver :    org.apache.derby.jdbc.ClientDriver

instead of

Metastore connection URL:    jdbc:mysql://localhost/metastore
Metastore Connection Driver :    com.mysql.jdbc.Driver
Bryan Pendleton
  • 16,128
  • 3
  • 32
  • 56
  • where to change these? I am using 0.12.0. I jst extracted the package. Should I create any of the files in extra?Like hive -site – USB Feb 04 '14 at 03:16
1

For this specific error "Failed to load driver", you should check if you have the mysql connector copied or has a link in Hive lib folder.

ln -s /usr/share/java/mysql-connector-java.jar $HIVE_HOME/lib/mysql-connector-java.jar

(Download it if you don't have it within the Java libs)

Similarly get the lib for Derby too.

0

The error message is very broad. To get more information on the root cause, schematool supports the -verbose flag:

schematool -dbType derby -initSchema -verbose

This will print the full stacktrace, which in my case indentified the missing database:

Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown database 'metastore'

Murmel
  • 5,402
  • 47
  • 53