Loading EXASOL data in R. Unknown ODBC error - r

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")

Related

R Redshift Error in .jfindClass

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

Could open accdb database (MS Access) from R and now I can't

I have a little R code that was working perfectly well until a few days ago and now, all of a sudden, it works on some PCs and it doesn't in others. Does anybody know if any update has been pushed by MS that could be causing the trouble?
I'm running R-32bit in all PCs and the ones not working seem to have upgraded MS Access 2010 to 2016.
This is my code:
library(RODBC)
testdb <- file.path("foo.accdb")
channel <- odbcConnectAccess2007(testdb)
tables_list=grep("foo_table", sqlTables(channel)[,3], value=TRUE) # list of tables with matching names
odbcCloseAll()
The error message I get is:
Error in sqlTables(channel) : first argument is not an open RODBC
channel
In addition: Warning messages: 1: In odbcDriverConnect(con, ...) :
[RODBC] ERROR: state IM002, code 0, message [Microsoft][ODBC Driver
Manager] Data source name not found and no default driver specified 2:
In odbcDriverConnect(con, ...) : ODBC connection failed
Mystery solved! Apparently the upgrade to MS Access 2016 deleted the 32-bit drivers for ODBC. Reinstalling the Microsoft Access Database Engine 2010 32-bit got things to work again.
Thanks to all for your help!

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.

dbConnect with R 3.0 on Ubuntu 12.04 x64 --Error in as.integer(from) : cannot coerce type 'S4' to vector of type 'integer'

Just updated to R 3.0 and updated all the packages, including DBI. To my surprise, a script that I often use stopped working.
I am unable to connect to a MySQL database using dbConnect. The code script instantly, so only a few lines will reproduce the problem
> require("RMySQL")
> m = dbDriver("MySQL")
> dbConnect(m, user = 'user', password = 'pass', dbname = 'dbname', host = 'localhost', client.flag = CLIENT_MULTI_STATEMENTS)
Error in as.integer(from) :
cannot coerce type 'S4' to vector of type 'integer'
Calls: dbConnect ... mysqlNewConnection -> isIdCurrent -> as -> asMethod
Also tried it as:
dbConnect(MySQL(), user = 'user', password = 'pass', dbname = 'dbname', host = 'localhost', client.flag = CLIENT_MULTI_STATEMENTS)
but the same problem
Also tried removing other parameters, but the same issue from the dbDriver.
What changed in the DBI package with the latest update? How can I fix this?
I noticed that the DBI package is orphaned so don't know who to ask.
I had the same issue with R 3.0.1 on ubuntu.
Installing the latest version of the RMySQL-package resolved the problem:
> install.pacakges("RMySQL")
Make sure to restart R after the installation.
I'm still digging into the issue, but I think I've identified multiple causes of this issue. At their root, they all have to do with R expecting an S4 object but getting back an integer instead. I believe these are generally a result of the connection failing to establish.
Why is it failing? One thing I've noticed is that if you fail to close to many of your connections (~16 [see the number of maximum connections specified in the driver handle call] open) DBI won't/can't open a new connection. Make sure you are calling dbDisconnect as needed. Usually, this sort of problem results in a sensible error message, however sometimes results in the above referenced error. If possible access the DB through an abstraction layer, e.g. dplyr as some will monitor the db connections and kill them if they are inactive. Whereas, AFIK if you open a connection in a function and the function breaks, you have no way to close the open connection unless you returned the driver object from your initial call to dbConnect. In this case you have no choice but to restart your instance of R (possibly resetting your machine and clearing your workspace as well).
The other issue I recently encountered is that if RMySQL masks RPostgreSQL, then RPostgreSQL will fail. The reverse does not appear to be the case, but because others have mentioned RPostgreSQL in here as showing the same error message, it seemed worthy of note.
Update
The latest version of RMySQL (0.10.1) seems to have finished off RPostgreSQL - RPostgreSQL now fails to work regardless of load order. The same people working on RMySQL appear to be working on RPostgres (https://github.com/rstats-db/RPostgres) and this conflict appears to be a non-issue if using that package instead of RPostgreSQL. Specifically, use RPostgres::Postgres() in the place of RPostgreSQL::PostgreSQL() when specifying the driver in dbConnect. Other packages, e.g. dplyr, currently assume RPostgreSQL, so this issue can still bite (but it seems a resolution is in the works (https://github.com/rstats-db/RMySQL/issues/28).

Trouble with using RODBC to access Northwind.accdb file

I'm trying to demo SQL queries from within R using the Northwind.accdb file. I visited http://office.microsoft.com/en-us/templates/desktop-northwind-2007-sample-database-TC001228997.aspx and was able to download the .accdt file. I've tried creating a database connection using RODBC with the following two lines, but both return the same error that R is unable to find the file, even though I am certain of its location (on the desktop).
Here are the lines of code that I'm using:
conn <- odbcConnectAccess2007("Nwind.accdt", uid = "", pwd = "")
conn <- odbcConnectAccess2007("Nwind.accdb", uid = "", pwd = "")
The error output I'm getting looks like this:
Warning messages:
1: In odbcDriverConnect(con, ...) :
[RODBC] ERROR: Could not SQLDriverConnect
2: In odbcDriverConnect(con, ...) : ODBC connection failed
Very grateful for any pointers you all might have.
There are some problems when using 32 bit drivers on 64 bit Windows. If you have ODBC 32 bit installed, coming with older versions of Office, make sure that you are running 32-bit R (easy with RStudio under Tools).
Or, with 64 bit drivers, use 64 bit R.

Resources