Search code examples
sqlrhsqldbodb

Connecting R to open office database using ODB


Despite several efforts I do not succeed to read my tables in an open office database in R.

I have loaded the ODB package. And connect using the command

con <- odb.open('Database.odb')

to connect when i use the command

odb.tables(con)

The console shows me the following

$Datasets
    field.name field.type data.type comment
1           ID    INTEGER   numeric    <NA>
2 Dataset_naam    VARCHAR character    <NA>
3 Beschrijving    VARCHAR character    <NA>
4     Eigenaar    VARCHAR character    <NA>
5      Cluster       CHAR character    <NA>
6   Vindplaats    VARCHAR character    <NA>

Looks promising, however when I try to actually acces the table like this

odb.read(con, 'SELECT * FROM Datasets')

the following error is thrown.

Error: Error while executing SQL query  : "Unable to retrieve JDBC `result set for SELECT * FROM Datasets (Table not found in statement [SELECT * FROM Datasets])"`

Why can I not acces the table?

On the other hand if I try to create tables They do not show when I open the open office database.

Any advise would be greatly appreciated.


Solution

  • You must write the name of a table. Try the following:

    odb.read(con, 'SELECT * FROM Cluster')