ODBC Firebird Driver Unable to connect to data source;library'gds32.dll' failed to load
Asked Answered
R

1

6

I want to build a connection between ODBC and Firebird. It has shown error messages like these:

[ODBC Firebird Driver] Unable to connect to data source; library'gds32.dll' failed to load

[ODBC Firebird Driver] Invalid connection string attribute.

Here is my code:

Dim conn As ADODB.connection            
Dim vError As Variant                   
Dim sErrors As String                  
Dim stringsql As Long               
Dim dbs As DAO.Database                
Dim recordset_case As ADODB.Recordset

'*************************************************************
'Setting up connection between IRIS data and central database
'***********************************************************
'1.set up connection
Set conn = New ADODB.connection
On Error Resume Next
conn.Open "DRIVER=Firebird/InterBase(r) driver; 
DBNAME=C:\IRIS\Data\IRIS_TEST.IB; UID=SYSDBA; PWD=masterkey;READONLY = YES"
On Error GoTo 0

'to test whether the connection has been built over the IRIS and central database
If conn.State = adStateOpen Then
    'adstateopen=the object is open
    MsgBox "Connection Succeeded", vbInformation
Else
    For Each vError In conn.Errors
        sErrors = sErrors & vError.Description & vbNewLine
    Next vError
    If sErrors > "" Then
        MsgBox sErrors, vbExclamation
    Else
        MsgBox "Connection Failed", vbExclamation
    End If
End If

At this stage, I have tried these following steps:

  1. Based on this article, I have renamed the fdclient.dll to gds32.dll and copied to system32 file. Then I selected Firebird client library in the Firebird ODBC driver setting.
    This does not work.

  2. Uninstall and reinstall Firebird. Due to Firebird being a part of our software package, we did follow that step. Beside, we have checked the Firebird is the latest version for 2.5.4. Thus, we do have the latest version for Firebird server.
    That does not work either.

Roundsman answered 6/5, 2015 at 1:53 Comment(6)
Did you try to put the gds32.dll in the same folder where you have your binary? Also I remember you have to add some other files besides the gds32.dll.Irretentive
What is the bitness (32 bit or 64) of: Windows, your Firebird install and the installed ODBC driver?Mutter
@Irretentive Yes, I did. But which file are you referring to?Roundsman
@MarkRotteveel We have 32bit Firebird installed in 64 bit of Windows.Roundsman
@hanhanStacey I used Firebird with an embebed server. I think that is because I put more files in the same folder. Maybe the problem is caused by a 32bits/64bits incompatibility. (The library was compiled for 32 bits specifically and it was not compiled for any CPU). Did you try to compile your project only for 32bits to check if that works?Irretentive
Thanks. I am using 32-bit MS Access for the project, hence the 32-bit ODBC driver. What is strange is that the error occurs when trying to connect via VBA. If I create a linked table to the same source or open a previously linked table the ADODB connection via VBA works fine. So something seams to be missing around getting the DLL loaded.Roundsman
M
14

On windows 64 bit the 32 bit dll files are in SysWoW64, not system32 (that, logically..., contains the 64 bit dlls).

If you want to install the 32 bit gds32.dll, I'd strongly advise to use the instclient.exe included in the Firebird install instead of renaming fbclient.dll. For a 64 bit Firebird the one in bin\ is for 64 bit, the 32 bit is in wow64 or wow (I believe, I don't have a Windows install at hand).

To run instclient.exe, start a command prompt as administrator.

To install fbclient.dll use:

instclient i f

To install gds32.dll use:

instclient i g

Make sure you pick the right instclient (from bin for 64 bit or from wow or wow64 for 32 bit); or just install both. Also make sure you have installed the 32 bit ODBC driver for Firebird.

Regarding your last comment: I am at loss to explain this; maybe it uses a different config or driver?

Mutter answered 15/5, 2015 at 6:19 Comment(1)
Hi Mark,thank you so much for this helpful advice. The problem is solved now! Really appreciate your contribution and efforts.Roundsman

© 2022 - 2024 — McMap. All rights reserved.