- edited description
Looking for odbc library for R
There is dbi library for R, but no odbc library.
How can I access to Db2 for i from R on i?
I tried install.packages("odbc") from “1: 0-Cloud [https]” but it failed by TZ issue.
Thank you for your help.
Uzaemon@Japan
Comments (9)
-
reporter -
I believe the TZ messages you are seeing are only warnings. Do you have the full output?
Also, if you haven’t already, you will need to install developer tools (
yum group install "Developer Tools"
), R-devel (R-devel
), and unixODBC-devel (yum install unixODBC-devel
). Plus, you need to install the ODBC driver itself as documented at https://github.com/IBM/ibmi-oss-examples/blob/master/odbc/odbc.md
-
reporter - attached install_log.txt
-
reporter - attached odbcinst_j.txt
-
reporter - attached yum_list.txt
-
reporter Thank you very much for your reply!
Do you have the full output?
Yes. Please check out “install_log.txt”.
Also, if you haven’t already,
I think I’ve installed all pre-requisites.
- Packages → yum_list.txt
- odbc → odbcinst_j.txt (working well with “pyodbc”)
If you need more info, please let me know.
I very much appreciate your help.uzaemon@Japan
-
The problem is here:
ar: 0707-126 time_zone_format.o is not valid with the current object file mode. Use the -X option to specify the desired object mode.
The default for most tools within PASE are for 32-bit mode, but we build everything as 64-bit by default so you have to set some flags that most software doesn’t know about.
You can get around this by setting OBJECT_MODE=64 before running the install:
export OBJECT_MODE=64
-
reporter Thank you Kevin, odbc now works with R!
List all packages:
> str(allPackage <- installed.packages(.Library)) chr [1:43, 1:16] "BH" "DBI" "KernSmooth" "MASS" "Matrix" "Rcpp" "base" ... - attr(*, "dimnames")=List of 2 ..$ : chr [1:43] "BH" "DBI" "KernSmooth" "MASS" ... ..$ : chr [1:16] "Package" "LibPath" "Version" "Priority" ... > allPackage [, c(1,3:5)] Package Version Priority BH "BH" "1.72.0-3" NA DBI "DBI" "1.1.0" NA (SNIP) odbc "odbc" "1.2.2" NA
Test run:
> library(odbc) > con <- dbConnect(odbc(), "*LOCAL") > library(DBI) > dbGetQuery(con, 'select SCHEMA_NAME, SCHEMA_OWNER, SCHEMA_CREATOR, CREATION_TIMESTAMP from qsys2.sysschemas') SCHEMA_NAME SCHEMA_OWNER SCHEMA_CREATOR CREATION_TIMESTAMP 1 #CGULIB QSYS QLPINSTALL 2018-09-01 02:06:46 2 #COBLIB QSYS QSECOFR 2018-09-25 09:43:14 (SNIP) Warning messages: 1: In as.POSIXlt.POSIXct(x, tz) : unknown timezone '<JST>-9' 2: In format.POSIXlt(as.POSIXlt(x, tz), format, usetz, ...) : unknown timezone '<JST>-9'
Is there any way to remove “timezone” warnings?
- I checked valid tz by OlsonNames() and ran code below replacing “xxx” to “Japan”, “Asia/Tokyo”, “GMT”, “UTC”, etc. but nothing worked.
> Sys.setenv(TZ="xxx") > Sys.getenv("TZ") [1] "xxx" > as.POSIXct(t, tz=getOption("tz")) Error in as.POSIXct.default(t, tz = getOption("tz")) : do not know how to convert 't' to class "POSIXct"
Thank you for your kind support.
Uzaemon@Japan
-
- changed status to resolved
- Log in to comment