USB
USB

Reputation: 6139

Hive Metastore is not creating MYSQL or Derby Connection

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

Upvotes: 1

Views: 10740

Answers (4)

Murmel
Murmel

Reputation: 5702

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'

Upvotes: 0

user2124655
user2124655

Reputation: 61

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.

Upvotes: 1

Bryan Pendleton
Bryan Pendleton

Reputation: 16359

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

Upvotes: 1

buddy86
buddy86

Reputation: 1454

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

Upvotes: 3

Related Questions