Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Unable to Connect R studio to hive using JDBC Driver

4166174Jan 8 2020 — edited Jan 23 2020

I have recently switched from windows to unix system and when I try to run my code it gives me an error.

Sys.setenv(JAVA_HOME = "/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.221-2.6.18.1.el7.x86_64/")

#set option for Kerberos support. If not set, only login with usercredentials will work

Sys.setenv(JAVA_TOOL_OPTIONS="-Djavax.security.auth.useSubjectCredsOnly=false")

library("DBI")

library("rJava")

library("RJDBC")

cp=c("/opt/hadoop/java/hadoop-auth-2.7.3.2.6.5.0-292.jar"

     ,"/opt/hadoop/java/hadoop-common-2.7.3.2.6.5.0-292.jar"

     ,"/opt/hadoop/java/hive-jdbc-1.2.1000.2.6.5.0-292-standalone.jar"

)

.jinit(classpath=cp)

drv <- JDBC("org.apache.hive.jdbc.HiveDriver",

            cp,

           identifier.quote="`")

conn <-dbConnect(drv,"jdbc:hive2://url")

The error is -

an 08, 2020 4:09:24 PM org.apache.hive.jdbc.Utils parseURL

INFO: Supplied authorities: url

Jan 08, 2020 4:09:24 PM org.apache.hive.jdbc.Utils parseURL

INFO: Resolved authority: url

Jan 08, 2020 4:09:24 PM org.apache.hive.jdbc.HiveConnection openTransport

INFO: Will try to open client transport with JDBC Uri: url

Jan 08, 2020 4:09:24 PM org.apache.hive.jdbc.Utils parseURL

INFO: Supplied authorities:url

Jan 08, 2020 4:09:24 PM org.apache.hive.jdbc.Utils parseURL

INFO: Resolved authority:url

Jan 08, 2020 4:09:24 PM org.apache.hive.jdbc.HiveConnection openTransport

INFO: Will try to open client transport with JDBC Uri:url

Error in .jcall(drv@jdrv, "Ljava/sql/Connection;", "connect", as.character(url)[1],  :

  java.lang.IllegalArgumentException: java.lang.ClassCastException: java.util.Vector cannot be cast to java.util.Hashtable

I cannot share the url but I believe it's right as it works in windows.

I really appreciate your help.

Comments

Answer

Yes

Development Tutorial: Creating an Image Gallery

Note:

You can modify the default OAuth access token duration (or lifetime) for all the generated access tokens. To achieve this, add the security.oauth.tokenLifetime entry to the defaults.xml configuration file in the following way, with the OAuth access token duration specified in seconds:

<entry key="security.oauth.tokenLifetime”>600</entry>

Marked as Answer by Christoph · Sep 27 2020
Christoph

Thanks!

no problem, and sorry for the late response!

Ed S

Jeff,

I was having a similar problem so I am jumping in on this thread -I tried this and it is still expiring.  I just changed this to <entry key="security.oauth.tokenLifetime”>315360000</entry>  so as to last 10 years and it still appears to be expiring. When I created the new token and allowed access I get &expires_in=315360000&state= in the token confirmation. Any idea as to what the problem may be on my end?

Ed

Ed S

Disregard, this is working.

1 - 5

Post Details

Added on Jan 8 2020
1 comment
569 views