You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by Saurabh S <sa...@live.com> on 2013/05/07 20:55:21 UTC

Connecting to Hive from R through JDBC

Hi,
I'm trying to use package RJDBC to connect to hive through R. My client machine, on which R is installed, is Windows 7. I installed the package, then copied the file hive-jdbc-0.9.0-cdh4.1.2.jar to my local R work folder. Then used the following commands:
I was able to read the driver through following command:drv <- JDBC('org.apache.hadoop.hive.jdbc.HiveDriver',
'C:/Users/Saurabh/Documents/RWork/hive-jdbc-0.9.0-cdh4.1.2.jar')
But when I try to make the connection using the following command:conn <- dbConnect(drv,
'jdbc:hive://<hostname>:<port>/default')
I get the following error:java.lang.NoClassDefFoundError: org/apache/hadoop/hive/metastore/api/MetaException
Any idea why this is happening? Some say that it's best to have R and Hive on the same server so that you can just pass localhost in the dbConnect command. But that's not an option for me because even if R is installed on the Hadoop server, RJDBC isn't available and I'm just a local user.
Thanks,Saurabh 		 	   		  

Re: Connecting to Hive from R through JDBC

Posted by Sanjay Subramanian <Sa...@wizecommerce.com>.
Saurabh

Can u please try to install squirrel and point to hive jdbc jar and see if u can connect to Hive thru Squirrel client….It will just check if u can connect using another client

Thanks
sanjay


From: Saurabh S <sa...@live.com>>
Reply-To: "user@hive.apache.org<ma...@hive.apache.org>" <us...@hive.apache.org>>
Date: Wednesday, May 8, 2013 10:28 AM
To: "user@hive.apache.org<ma...@hive.apache.org>" <us...@hive.apache.org>>
Subject: RE: Connecting to Hive from R through JDBC

Thanks for the reply, Sanjay.

The Hive server is definitely running. I had once connected Hive from within Python, so it's not a server issue.

It looks more like java libraries issue on my local machine, but I can't figure out what's wrong.

________________________________
From: Sanjay.Subramanian@wizecommerce.com<ma...@wizecommerce.com>
To: user@hive.apache.org<ma...@hive.apache.org>
Subject: Re: Connecting to Hive from R through JDBC
Date: Wed, 8 May 2013 00:27:35 +0000

Hi Saurabh

The usual suspect looks like hive-server service is not running on server where hive is installed….The hive-server service needs to be installed and started….It listens on port 10000 by default.

Also on a side note is I hope your Hive connecting to MySQL or some non-derby RDBMS :-)

Thanks
sanjay

From: Saurabh S <sa...@live.com>>
Reply-To: "user@hive.apache.org<ma...@hive.apache.org>" <us...@hive.apache.org>>
Date: Tuesday, May 7, 2013 11:55 AM
To: "user@hive.apache.org<ma...@hive.apache.org>" <us...@hive.apache.org>>
Subject: Connecting to Hive from R through JDBC

Hi,

I'm trying to use package RJDBC to connect to hive through R. My client machine, on which R is installed, is Windows 7. I installed the package, then copied the file hive-jdbc-0.9.0-cdh4.1.2.jar to my local R work folder. Then used the following commands:

I was able to read the driver through following command:

drv <- JDBC('org.apache.hadoop.hive.jdbc.HiveDriver', 'C:/Users/Saurabh/Documents/RWork/hive-jdbc-0.9.0-cdh4.1.2.jar')


But when I try to make the connection using the following command:

conn <- dbConnect(drv, 'jdbc:hive://<hostname>:<port>/default')


I get the following error:

java.lang.NoClassDefFoundError: org/apache/hadoop/hive/metastore/api/MetaException


Any idea why this is happening? Some say that it's best to have R and Hive on the same server so that you can just pass localhost in the dbConnect command. But that's not an option for me because even if R is installed on the Hadoop server, RJDBC isn't available and I'm just a local user.


Thanks,

Saurabh


CONFIDENTIALITY NOTICE
======================
This email message and any attachments are for the exclusive use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message along with any attachments, from your computer system. If you are the intended recipient, please be advised that the content of this message is subject to access, review and disclosure by the sender's Email System Administrator.

CONFIDENTIALITY NOTICE
======================
This email message and any attachments are for the exclusive use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message along with any attachments, from your computer system. If you are the intended recipient, please be advised that the content of this message is subject to access, review and disclosure by the sender's Email System Administrator.

RE: Connecting to Hive from R through JDBC

Posted by Saurabh S <sa...@live.com>.
Thanks for the reply, Sanjay.
The Hive server is definitely running. I had once connected Hive from within Python, so it's not a server issue.
It looks more like java libraries issue on my local machine, but I can't figure out what's wrong.

From: Sanjay.Subramanian@wizecommerce.com
To: user@hive.apache.org
Subject: Re: Connecting to Hive from R through JDBC
Date: Wed, 8 May 2013 00:27:35 +0000






Hi Saurabh



The usual suspect looks like hive-server service is not running on server where hive is installed….The hive-server service needs to be installed and started….It listens on port 10000 by default.



Also on a side note is I hope your Hive connecting to MySQL or some non-derby RDBMS :-) 



Thanks
sanjay 





From: Saurabh S <sa...@live.com>

Reply-To: "user@hive.apache.org" <us...@hive.apache.org>

Date: Tuesday, May 7, 2013 11:55 AM

To: "user@hive.apache.org" <us...@hive.apache.org>

Subject: Connecting to Hive from R through JDBC







Hi,



I'm trying to use package RJDBC to connect to hive through R. My client machine, on which R is installed, is Windows 7. I installed the package, then copied the file hive-jdbc-0.9.0-cdh4.1.2.jar to my local R work folder. Then used the following commands:



I was able to read the driver through following command:

drv <- JDBC('org.apache.hadoop.hive.jdbc.HiveDriver', 'C:/Users/Saurabh/Documents/RWork/hive-jdbc-0.9.0-cdh4.1.2.jar')



But when I try to make the connection using the following command:

conn <- dbConnect(drv, 'jdbc:hive://<hostname>:<port>/default')



I get the following error:
java.lang.NoClassDefFoundError: org/apache/hadoop/hive/metastore/api/MetaException



Any idea why this is happening? Some say that it's best to have R and Hive on the same server so that you can just pass localhost in the dbConnect command. But that's not an option for me because even if R is installed on the Hadoop server,
 RJDBC isn't available and I'm just a local user.



Thanks,
Saurabh







CONFIDENTIALITY NOTICE

======================

This email message and any attachments are for the exclusive use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient,
 please contact the sender by reply email and destroy all copies of the original message along with any attachments, from your computer system. If you are the intended recipient, please be advised that the content of this message is subject to access, review
 and disclosure by the sender's Email System Administrator.

 		 	   		  

Re: Connecting to Hive from R through JDBC

Posted by Sanjay Subramanian <Sa...@wizecommerce.com>.
Hi Saurabh

The usual suspect looks like hive-server service is not running on server where hive is installed….The hive-server service needs to be installed and started….It listens on port 10000 by default.

Also on a side note is I hope your Hive connecting to MySQL or some non-derby RDBMS :-)

Thanks
sanjay

From: Saurabh S <sa...@live.com>>
Reply-To: "user@hive.apache.org<ma...@hive.apache.org>" <us...@hive.apache.org>>
Date: Tuesday, May 7, 2013 11:55 AM
To: "user@hive.apache.org<ma...@hive.apache.org>" <us...@hive.apache.org>>
Subject: Connecting to Hive from R through JDBC

Hi,

I'm trying to use package RJDBC to connect to hive through R. My client machine, on which R is installed, is Windows 7. I installed the package, then copied the file hive-jdbc-0.9.0-cdh4.1.2.jar to my local R work folder. Then used the following commands:

I was able to read the driver through following command:
drv <- JDBC('org.apache.hadoop.hive.jdbc.HiveDriver', 'C:/Users/Saurabh/Documents/RWork/hive-jdbc-0.9.0-cdh4.1.2.jar')

But when I try to make the connection using the following command:
conn <- dbConnect(drv, 'jdbc:hive://<hostname>:<port>/default')

I get the following error:
java.lang.NoClassDefFoundError: org/apache/hadoop/hive/metastore/api/MetaException

Any idea why this is happening? Some say that it's best to have R and Hive on the same server so that you can just pass localhost in the dbConnect command. But that's not an option for me because even if R is installed on the Hadoop server, RJDBC isn't available and I'm just a local user.

Thanks,
Saurabh

CONFIDENTIALITY NOTICE
======================
This email message and any attachments are for the exclusive use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message along with any attachments, from your computer system. If you are the intended recipient, please be advised that the content of this message is subject to access, review and disclosure by the sender's Email System Administrator.