0

I am trying to enter hive shell from cli but its failing by throwing below error:- I followed exactly this link for the installation :-http://www.tutorialspoint.com/hive/hive_installation.htm

Exception in thread "main" java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient

Caused by: javax.jdo.JDOFatalDataStoreException: Unable to open a test connection to the given database. JDBC url = jdbc:derby://localhost:1527/metastore_db;create=true , username = APP. Terminating connection pool (set lazyInit to true if you expect to start your database after your app). Original Exception: ------ java.sql.SQLException: No suitable driver found for jdbc:derby://localhost:1527/metastore_db;create=true

java.sql.SQLException: Unable to open a test connection to the given database. JDBC url = jdbc:derby://localhost:1527/metastore_db;create=true , username = APP. Terminating connection pool (set lazyInit to true if you expect to start your database after your app). Original Exception: ------ java.sql.SQLException: No suitable driver found for jdbc:derby://localhost:1527/metastore_db;create=trueCaused by: java.sql.SQLException: Unable to open a test connection to the given database. JDBC url = jdbc:derby://localhost:1527/metastore_db;create=true , username = APP. Terminating connection pool (set lazyInit to true if you expect to start your database after your app).

Logging initialized using configuration in jar:file:/usr/local/hive/lib/hive-common-2.0.0.jar!/hive-log4j2.properties Exception in thread "main" java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient

Mahendra
  • 1,436
  • 9
  • 15
John Simon
  • 818
  • 11
  • 25
  • not sure whether this is the same problem, but check this link. I recently installed hive in ubuntu and faced the following problem. http://stackoverflow.com/questions/35655306/hive-installation-issues-hive-metastore-database-is-not-initialized – amitava May 13 '16 at 08:57
  • Have you restarted your `terminal` after configuring `.bashrc`. If yes then please share the output of `echo $CLASSPATH` and `ls -l $DERBY_HOME/lib/derbytools.jar` commands. – Mahendra May 13 '16 at 09:16
  • Yes I restarted .bashrc. The Output of echo $CLASSPATH is :/home/ajith/hadoop/lib/*:.:/usr/local/hive/lib/*:.:/usr/local/derby/lib/derby.jar:/usr/local/derby/lib/derbytools.jar And for ls -l $DERBY_HOME/lib/derbytools.jar ---> -rwxrwxrwx 1 root root 229665 Sep 20 2015 /usr/local/derby/lib/derbytools.jar – John Simon May 13 '16 at 09:46

3 Answers3

1
Place  sql driver in $HOME/lib folder


change hive-site.xml properties


<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>com.mysql.jdbc.Driver</value>
<description>Driver class name for a JDBC metastore</description>
</property>



<property>
    <name>javax.jdo.option.ConnectionURL</name>
    <value>jdbc:mysql://localhost:3306/hive_metastore_db?createDatabaseIfNotExist=true</value>
  </property>



<property>
  <name>datanucleus.autoCreateSchema</name>
  <value>true</value>
</property>

<property>
  <name>datanucleus.fixedDatastore</name>
  <value>true</value>
</property>

<property>
 <name>datanucleus.autoCreateTables</name>
 <value>True</value>
 </property>

 <property>
    <name>javax.jdo.option.ConnectionPassword</name>
    <value>root</value>
    <description>password to use against metastore database</description>
  </property>


 <property>
    <name>javax.jdo.option.ConnectionUserName</name>
    <value>root</value>
    <description>Username to use against metastore database</description>
  </property>
y durga prasad
  • 1,184
  • 8
  • 11
0

The link you are referring to install the hive is looking quite old (for apache-hive-0.14.0 which requires a separate derby database).

In place of this, you can try to install apache-hive-1.2.1 which have in-build derby database and you do not have to install and configure database explicitly.

You can try the steps mentioned in this blog install-hive-121-on-ubuntu-1404

Mahendra
  • 1,436
  • 9
  • 15
0

You have to start Derby Database before Starting hive server.

1527 port is Derby Port. While Start hive server,initially it access derby port.

So go to Derby\bin and Type "startNetworkServer"

After give above command 1527 port will listen, then start the hive metastore and hiveserver2.

Now hive server can able to work correctly.

Sure this more helpful for you

Mister X
  • 3,406
  • 3
  • 31
  • 72