R Redshift Error in .jfindClass - r

reading the Howto on connecting Redshift to R, and am getting an error, any ideas ?
source - https://aws.amazon.com/blogs/big-data/connecting-r-with-amazon-redshift/
after the driver <- line I get this error:
driver <- JDBC("com.amazon.redshift.jdbc41.Driver", "RedshiftJDBC41-1.1.9.1009.jar", identifier.quote="`")
Error in .jfindClass(as.character(driverClass)[1]) : class not found

this error went away when I downloaded the used the 42-driver, not the 41-driver
download.file('http://s3.amazonaws.com/redshift-downloads/drivers/RedshiftJDBC42-1.2.1.1001.jar','RedshiftJDBC42-1.2.1.1001.jar')
Hopefully this will help someone.. on Windows 7
Ray

Related

Loading EXASOL data in R. Unknown ODBC error

R is unable to read the EXASOL Database due to some unknown ODBC error. Has anyone come across a similar instance. The problem occurs with Mac OS.
I have installed the ODBC driver for Mac OS.
library(exasol)
library(RODBC)
con <- dbConnect("exasol", **)
# removed the connection credentials
df1 <- dbGetQuery(con,paste("query", sep=""))
# removed the query
Error in try(.Call(C_asyncRODBCQueryFinish, slot, 1)) :
Unknown ODBC error
Error in exa.readData(conn, statement, ...) :
Could not allocate SQLAllocHandle (-2)
Error in exa.readData(conn, statement, ...) : Unknown ODBC error
The issue is at the moment unanswered here https://github.com/exasol/r-exasol/issues/32.
Can you tell more about the tools/drivers/components you use? Version numbers and the like?
I have some faint memories of seeing the same (or very similar error message) when I tried to use unixodbc. I had to remove it and use libiodbc. May it be the source of the issue in your case?
I had a similar issue, what helped me was to reinstall install.packages("RODBC", type="source")

I am getting a class not found error when I try to connect R with AWS Redshift

I am trying to connect R with redshift using the JDBC template they provide on their website.
I got the most updated version of the redshift jdbc and pulled JDBC() and it's not working.
install.packages("RJDBC",dep=TRUE)
library(RJDBC)
download.file('https://s3.amazonaws.com/redshift-downloads/drivers/RedshiftJDBC42-1.2.10.1009.jar','RedshiftJDBC42-1.2.10.1009.jar')
driver_redshift <- JDBC("com.amazon.redshift.jdbc42.Driver",
"RedshiftJDBC41-1.1.9.1009.jar", identifier.quote="`")
I am getting an error that says Error in .jfindClass(as.character(driverClass)[1]) : class not found
Try to download the driver with binary mode:
download.file('https://s3.amazonaws.com/redshift-downloads/drivers/RedshiftJDBC42-1.2.10.1009.jar','RedshiftJDBC42-1.2.10.1009.jar', mode="wb");
Then make sure that you're referring the correct jar:
driver <- JDBC("com.amazon.redshift.jdbc42.Driver", "RedshiftJDBC42-1.2.10.1009.jar", identifier.quote="`")

Error in .jfindClass(as.character(driverClass)[1]) : class not found - Hive R

I am connected to a remote R server which is built on x86_64-redhat-linux-gnu (64-bit) platform. The R version installed in this server is 3.3.1. I want to connect to remote hive database using this R server so that I can extract data and do some analysis on it. I am trying the following things,
options( java.parameters = "-Xmx8g" )
library(rJava)
library(RJDBC)
drv <- JDBC("org.apache.hive.jdbc.HiveDriver",
"/home/username/R/x86_64-redhat-linux-gnu-library/3.3/hive-jdbc-0.10.0.jar",
identifier.quote="`")
I am getting error as Error in .jfindClass(as.character(driverClass)[1]) : class not found. I downloaded the jar file and kept it in this path , /home/username/R/x86_64-redhat-linux-gnu-library/3.3/. I have downloaded only this jar file. Inside this /home/username/R/x86_64-redhat-linux-gnu-library/3.3/ path, I am having three folders such as DBI, rJava and RJDBC and the file hive-jdbc-0.10.0.jar.
Apart from this have not downloaded anything else for now. Is there anything else which I need to download in order for this error to resolve?
Another attempt which I tried was,
hivedrv <- JDBC("org.apache.hadoop.hive.jdbc.HiveDriver",
c(list.files("/home/username/R/x86_64-redhat-linux-gnu-library/3.3/",pattern="jar$",full.names=T),
list.files("/home/username/R/x86_64-redhat-linux-gnu-library/3.3/",pattern="jar$",full.names=T)))
which ran without any error. But when I try the following command,
hivecon <- dbConnect(hivedrv, "jdbc:hive://hostname:portname/", "username", "password")
I am getting the following error,
Error in .jcall(drv#jdrv, "Ljava/sql/Connection;", "connect", as.character(url)[1], :
java.lang.NoClassDefFoundError: org/apache/hadoop/hive/metastore/api/MetaException
Not sure how to solve this problem. Can anybody please help me in connecting the R server to Hive database? Any information would be helpful.

Getting Error in readRDS(cache_path) : error reading from connection

I am trying to solve quiz 2 in Coursera for Getting and Cleaning Data. I get the error :"Error in readRDS(cache_path) : error reading from connection" when I execute the following statement:
ONgithub_token <- oauth2.0_token(oauth_endpoints("github"), myapp)
I have searched and see that there are solutions for readRDS(file) but not readRDS(cache_path).
I am on Windows10, R version is 3.3.0
Appreciate your help.
Thanks.

RODBC Error Code 202 When Trying to Connect to DB

I'm getting errors like the following when I try to connect to a database using RODBC:
ch <- odbcConnect("getdata",uid='uid',pwd='pwd')
[RODBC] ERROR: state , code 202, message ��������������������
What is code 202? And what is that unreadable message supposed to be? I'm running R 3.0.2 on OS X 10.8.
I got rid of this error message by recompiling the psqlodbc driver without unicode support.
I still can't connect using RODBC though.

Resources