Looking for odbc library for R

Issue #128 resolved
矢作英幸 created an issue

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)

  1. 矢作英幸 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.

    If you need more info, please let me know.
    I very much appreciate your help.

    uzaemon@Japan

  2. Kevin Adler

    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
    

  3. 矢作英幸 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

  4. Log in to comment