smoff
smoff

Reputation: 648

R connect to firebird using RODBC

I'm trying to connect to a firebird database using the library RODBC. Since I don't have much, if any, experience with databases and RODBC I'm struggling with it.

I'm using the ODBC driver ODBC_2.0.5.156_x64.

Here is what I tried:

library(RODBC)
path.to.fdb <- "C:/TEMP/local.fdb"
p <- paste("DRIVER=Firebird/InterBase(r) driver; DBNAME=", path.to.fdb)
odbcDriverConnect(p, case = "toupper")

And I get the error message:

1: Status 08004, Code -904, Message [ODBC Firebird Driver] Unable to connect to data source: library 'gds32.dll' failed to load

2: In odbcDriverConnect(paste(p, db, sep = ""), case = "toupper") : ODBC-Connection failed

Maybe that is a stupid question, but is somebody able to helb me? How may I connect to a local firebird database in R?

Here is the fdb file: https://drive.google.com/open?id=1Kw53B-_DsUW1O1Q5GrMnUFrtsBzDoAwn

Upvotes: 1

Views: 2634

Answers (2)

Mark Rotteveel
Mark Rotteveel

Reputation: 109264

To be able to use Firebird ODBC you need three things:

  1. The Firebird ODBC driver (in the same bitness as your application, so 64 bit application, then 64 bit ODBC driver).
  2. A Firebird client library (fbclient.dll (or libfbclient.so on Linux), sometimes gds32.dll), again this must be the same bitness as the ODBC driver and the application. On Windows, the client library can be installed using the Firebird server installer.
  3. A Firebird server to access the database. This could also be an embedded Firebird, but that is actually more work to get up and running than installing a normal Firebird server.

Check the Firebird ODBC driver documentation for configuration details.

Upvotes: 1

Ricardo Andrade
Ricardo Andrade

Reputation: 59

For those who are still struggling to achieve a successful connection check this up:

  • Use the 32-bits R version
  • Make sure you are using 32 bits files "gds32.dll/fbclient.dll", especially for fbclient.dll.
  • Do points 1,3 from Mark Rotteveel's suggestion. Remember to set up/Add your data base (.fdb) into c:\Windows\SysWOW64\odbcad32.exe config. You're gonna need usr/pss.

After that you can simply do:

conn <- odbcConnect("your_db_name_in_odbcad32.exe")
data <- sqlQuery(conn, "SELECT * FROM some_table")

Have fun!

Upvotes: 0

Related Questions