Here comes what is almost self-contained. Unfortunately I was not able to find a command-line tool to configure the ODBC DSN.

apt-get install r-cran-rodbc libsqliteodbc sqlite3 unixodbc-bin \
        r-cran-rsqlite

sqlite3 testdb.sqlite 'create table test
        (id integer primary key, test text);
        insert into test values (1, "test");'

ODBCManageDataSourcesQ4
# add DSN with name 'testdb' referring to
# testdb.sqlite with SQLite3 driver

echo 'library(RODBC)
        sqlQuery(odbcConnect("testdb"), "select * from test")' |
        R --vanilla
        # crashes R

echo 'library(RSQLite)
        dbGetQuery(dbConnect("SQLite", dbname="testdb.sqlite"),
        "select * from test")' |
        R --vanilla
        # returns a data.frame as expected

Am 27.08.2012 15:12, schrieb Dirk Eddelbuettel:

On 27 August 2012 at 11:46, Tom Gottfried wrote:
| Dear R-SIG-Debian,
|
| while trying to query data from an SQLite database through RODBC on
| Debian testing, R crashes with the following message:
|
| library(RODBC)
| con3<- odbcConnect("test3")
| # 'test3' being an ODBC datasource configured with SQLite3 driver,
| # but the same happens with SQLite driver
| sqlQuery(con3, "select * from test") # 'test' being any table

Please provide a self-contained example which

   -- creates a tempfile
   -- puts a sqlite3 db into it
   -- access this temp db from R
   -- has R crashing

as there is nothing reproducible in your report.  I would also suggest to
skip ODBC at first and focus on the RSQLite package.

Dirk

|
|   *** caught segfault ***
| address 0x438, cause 'memory not mapped'
|
| Traceback:
|   1: .Call(C_RODBCQuery, attr(channel, "handle_ptr"),
| as.character(query),     as.integer(rows_at_time))
|   2: odbcQuery(channel, query, rows_at_time)
|   3: sqlQuery(con3, "select * from test")
|
| Possible actions:
| 1: abort (with core dump, if enabled)
| 2: normal R exit
| 3: exit R without saving workspace
| 4: exit R saving workspace
| Selection: 1
| aborting ...
| Segmentation fault
|
|
|
| This is what sessionInfo says:
|
| R version 2.15.1 (2012-06-22)
| Platform: x86_64-pc-linux-gnu (64-bit)
|
| locale:
| [1] C
|
| attached base packages:
| [1] stats     graphics  grDevices utils     datasets  methods   base
|
| other attached packages:
| [1] RODBC_1.3-6
|
|
|
| I tested the same under Windows 7 with the same sqlite-file without any
| problem. sessionInfo for the Windows-system:
|
| R version 2.15.1 (2012-06-22)
| Platform: x86_64-pc-mingw32/x64 (64-bit)
|
| locale:
| [1] LC_COLLATE=German_Germany.1252  LC_CTYPE=German_Germany.1252
| [3] LC_MONETARY=German_Germany.1252 LC_NUMERIC=C
| [5] LC_TIME=German_Germany.1252
|
| attached base packages:
| [1] stats     graphics  grDevices utils     datasets  methods   base
|
| other attached packages:
| [1] RODBC_1.3-6
|
| loaded via a namespace (and not attached):
| [1] tools_2.15.1
|
|
|
| On the Debian system, both R and RODBC were installed from the Debian
| repositories. I also tried with an RODBC build from source with the R
| mechanisms (install.packages()), which results in the same error.
|
| Any idea what is the cause or how I could sort it out?
|
| Thank you very much!
| Tom
| --
| Indo-German Centre for Sustainability
| Indian Institute of Technology Madras
| 600 036 Chennai, India
| www.igcs-chennai.org
|
| _______________________________________________
| R-SIG-Debian mailing list
| [email protected]
| https://stat.ethz.ch/mailman/listinfo/r-sig-debian


--
Indo-German Centre for Sustainability
Indian Institute of Technology Madras
600 036 Chennai, India
www.igcs-chennai.org

_______________________________________________
R-SIG-Debian mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-debian

Reply via email to