1
votes

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

2
Which ODBC driver for Firebird do you have installed (include the version). Also provide the exact, full, error message. - Mark Rotteveel
OK, I just realized that I didn't have any driver installed. But installing ODBC_2.0.5.156_x64 didn't solve the problem. I've edited the question... - smoff
The error in your edited question means that you don't have the Firebird client library installed, which likely also means you don't have Firebird itself installed, which is needed to be able to open a Firebird database. Download and install Firebird server from firebirdsql.org/en/server-packages - Mark Rotteveel
Thank you very much. I didn't know that I had to have firebird installed. It works now. - smoff
But installing ODBC_2.0.5.156_x64 - notice that for Windows to load DLLs they have to be all the same bitness, all x86 or x64. That means both your application, ODBC library and Firebird client libraries (gds32.dll/fbclient.dll) - Arioch 'The

2 Answers

1
votes

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.

0
votes

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!