Firebird Embedded & Delphi "unavailable database" - delphi

I'm using Firebird 2.5 (Embedded) And Delphi XE2.
I kept below files to my aplication root dir :
C:\myapp\app.exe
C:\myapp\fbclient.dll
C:\myapp\icudt30.dll
C:\myapp\icuin30.dll
C:\myapp\icuuc30.dll
C:\myapp\dbxfb.dll
And My Connection Settings :
procedure TMainForm.Button1Click(Sender: TObject);
var Con: TSQLConnection;
begin
Con := TSQLConnection.Create(Self);
With Con Do
Begin
Connected := False;
DriverName := 'FirebirdConnection';
Params.Clear;
Params.Add('DriverName=' + DriverName);
Params.Add('User_Name=SYSDBA');
Params.Add('Password=masterkey');
Params.Add('Database=C:\GHARARDAD.FDB');
Params.Add('SQLDialect=3');
LoginPrompt := False;
ConnectionName := 'Gharardad';
LibraryName := 'dbxfb.dll';
VendorLib := 'C:\fbclient.dll'; // Renamed fbembed.dll to fbclient.dll
GetDriverFunc := 'getSQLDriverInterBase';
Connected := True;
End;
End;
My Operation sys is : Win 7 64 bit
And FB embedde ver is : Firebird-2.5.1.26351-0_Win32_embed
And my app Compiled on 32 bit
DLL Sizes :
fbembed.dll -----> size 3,784,704 bytes
dbxfb.dll -----> size 288,768 bytes
But when i want to Run application, I get following Error:
DBX Error: Driver could not be properly. Client may be misiing, not
installed properly, of the wrong version, or thr driver may be misiing
from the system path.
What am I doing wrong?

You need specify Database parameter like this:
Params.Add('Database=C:\Full\Path\GHARARDAD.FDB');
I see you want to use embedded version, you need to use fbembed.dll insead of fbclient.dll

I don't know why you use ConnectionName if you allready specify database User_Name Password.
I would prefer something like this :
Con := TSQLConnection.Create(Self);
With Con Do
Begin
Connected := False;
DriverName := 'FirebirdConnection';
LibraryName := 'dbxfb.dll';
VendorLib := 'fbembed.dll';
ConnectionName := 'Gharardad';
Params.Value['User_Name'] := 'SYSDBA';
Params.Value['Password'] := 'masterkey';
Params.Value['Database'] := 'C:\GHARARDAD.FDB';
Connected := True;
End;

Do u have any other connections open to that database ?
FlameRobin, IBExpert, Delphi IDE Form Designer ?
Do you have any active datasets/connections in Delphi ?
Embedded requires non-shareable opening of file.
Run SysInternals Process Explorer and do search for your database file if it is already open by some another application
Do u really use weirdly renamed firebird embedded and not firebird client ?
#Marcodor and #Re0sless already asked you that.
It seems that you only think you're using embedded but u only have small share of server installed without main engine.
fbembed.dll 2.5.1 Win32 size is 3 784 704 bytes
fbclient.dll 2.5.1 Win64 size is 870 912 bytes
fbclient.dll 2.5.1 Win32 size is 548 864 bytes
Which is yours DLL ?
This can also be that database engine version and database file version do not match. Try SysInternals Process Monitor to see which files does your application try to find and open. Does it succesfully open the db files ? does it successfully find and open firebird.msg ? does it succesfully open icu*.dll ? maybe udf dlls ?
Is there some error written into firebird.log ?
In general - learn to use SysInternals Process Monitor to know what files and where were tried. It very frequently would hint you what error happened exactly and why.
You did not listed fbintl.dll
If your database containst non-Latin letters and non-English language, then it might be unable to open it without properly located fbintl. Check in Process Monitor where it is searched for and put there.
check in Process Monitor which firebird dll version your application actually loads. Is its version new enough to open that database ?

You said your using Firebird embedded but you are using the standard firebird VendorLib
VendorLib := 'fbclient.dll';
For embedded firebird this should be
VendorLib = '[pathtolib]\fbembed.dll'
You are also missing the value for GetDriverFunc
So the complete TSQLConnection object would looks like so (tested in Delphi 2007)
Con := TSQLConnection.Create(Self);
With Con Do
Begin
Connected := False;
DriverName := 'FirebirdConnection';
Params.Clear;
Params.Add('DriverName=' + DriverName);
Params.Add('User_Name=SYSDBA');
Params.Add('Password=masterkey');
Params.Add('Database=C:\GHARARDAD.FDB');
Params.Add('SQLDialect=3');
//other connection params here
ConnectionName := 'Gharardad';
LibraryName := 'dbxfb.dll';
VendorLib := 'C:\fbembed.dll';
GetDriverFunc = 'getSQLDriverInterBase' //Or what ever the dbxfb.dll function is called
Connected := True;
End;
End;
Note that the getSQLDriverInterBase function is the name of the function from the Devart firebird library so it may differ in the dbxfb.dll library.

Related

Why the compiler is unable to load the library name dbexpint.dll?

I'm a new user o Delphi 10.2 Tokyo (trial version) when I compile the program source code this error message appears:
Unable to load dbexpint.dll (ErrorCode 126). It may be missing from the system path.
This code should access a Firebird database, I have Firebird Client 3.0 installed on my machine. inside the installation folder I have the DLLs:
FBCLIENT.DLL
MSVCP100.DLL
MSVCR100.DLL
Below is part of the source code.
unit uDataModule;
interface
uses
SysUtils, Classes, DBXCommon, DB, DBClient, SimpleDS, SqlExpr, FMTBcd,
ADODB, Data.DBXInterBase, Data.DBXOracle;
...
procedure TDM.DataModuleCreate(Sender: TObject);
var
strPath: String;
begin
//Conex?o Firebird SPIRIDON
SQLSpiridonConnection.Params.Clear;
SQLSpiridonConnection.Params.Values['DatabaseServer'] := 'Interbase';
SQLSpiridonConnection.Params.Values['Database'] := 'XXXXXXXXXX:f:\dados\database\XXXXXXXXXXXX.FDB';
SQLSpiridonConnection.Params.Values['SQLDialect'] := '3';
SQLSpiridonConnection.Params.Values['DriverName'] := 'Interbase';
SQLSpiridonConnection.Params.Values['VendorLib'] := 'gds32.dll';
SQLSpiridonConnection.Params.Values['User_Name'] := 'XXXXXXXX';
SQLSpiridonConnection.Params.Values['Password'] := 'XXXXXXXX';
SQLSpiridonConnection.Params.Values['LibraryName'] := 'dbexpint.dll';
SQLSpiridonConnection.Params.Values['GetDriverFunc'] :=
'getSQLDriverINTERBASE';
SQLSpiridonConnection.Connected:= True;
I tried to download the DLL and put it in the system32 and wow64 folders, but it was not effective.
I tried changing the reference from the Library name line to dbxint.dll, but the following error appears:
DBX Error: Driver could not be properly initialized. Client library may be missing, not installed properly, of the wrong version, or the driver may be missing from the system path.
I don't know what's wrong and how I can solve it. Please, can you guys help me?
dbexpint.dll is the dbExpress Interbase driver for (old) Delphi versions from Delphi 6 to Delphi 2005. It could also be used to connect with Firebird databases, while newer Delphi versions use separate drivers for each one.
This driver is not compatible with Delphi versions 2006 and later. Instead, Delphi 10.2 now uses dbxint.dll for Interbase, and dbxfb.dll for Firebird.
The params of dbxfb.dll are similar to that of dbexpint.dll.
If you create a new form, drop a TSQLConnection on it and select FBConnection as the value of the ConnectionName property, then the Driver property will automatically be assigned with the needed value Firebird, and the Params property will also be populated with suitable values:
object SQLConnection1: TSQLConnection
ConnectionName = 'FBConnection'
DriverName = 'Firebird'
Params.Strings = (
'DriverName=Firebird'
'Database=database.fdb'
'RoleName=RoleName'
'User_Name=sysdba'
'Password=masterkey'
'ServerCharSet='
'SQLDialect=3'
'ErrorResourceFile='
'LocaleCode=0000'
'BlobSize=-1'
'CommitRetain=False'
'WaitOnLocks=True'
'IsolationLevel=ReadCommitted'
'Trim Char=False')
Left = 312
Top = 172
end
Note: As mentioned by #DavidHeffernan in the comments, don't put DLLs into system directories. Better put it in the same folder as your exe file.
Thanks guys for the help.
I found a way to fix the error:
Actually the dbexpint.dll driver only worked on the older versions of Delphi. The current driver is dbxfb.dll for connections to the Firebird database.
Firstly I changed the lines of code as below.
SQLSpiridonConnection.Params.Clear;
SQLSpiridonConnection.Params.Values['DatabaseServer'] := 'Firebird';
SQLSpiridonConnection.Params.Values['Database'] := 'xxxxxxxxxxxxx:f:\dados\database\xxxxxxxxxx.FDB';
SQLSpiridonConnection.Params.Values['SQLDialect'] := '3';
SQLSpiridonConnection.Params.Values['DriverName'] := 'Firebird';
SQLSpiridonConnection.Params.Values['VendorLib'] := 'fbclient.dll';
SQLSpiridonConnection.Params.Values['User_Name'] := 'SYSDBA';
SQLSpiridonConnection.Params.Values['Password'] := 'xxxxxxx';
SQLSpiridonConnection.Params.Values['LibraryName'] := 'dbxfb.dll';
SQLSpiridonConnection.Params.Values['GetDriverFunc'] := 'getSQLDriverINTERBASE';
SQLSpiridonConnection.Connected:= True;
After that I inserted these dlls into the Firebird installation folder.
borlndmm.dll
dbxfb.dll
midas.dll
fbclient.dll this dll is already installed in the folder
The other dlls are inside the delphi installation folder.
Ex: C: \ Program Files (x86) \ Embarcadero \ Studio \ 19.0 \ bin
OBS: #DavidHeffernan Yes I did already asked this question, thanks for your comment

Setup an ODBC connection to a MS Access DB under Data Explorer in XE2 Enterprise that does not use a DSN

Using the Enterprise version of XE2, which includes native dbExpress ODBC support, I have successfully created a "Connection" where the Database Name is the name of the System DSN, and the Password is the MS Access database password.
I can click Test Connection on the Modify Connection page, and the Database Explorer reports Test connection succeeded.
Dragging and dropping the connection from the Data Explorer creates a TSQLConnection with the Driver property set to ODBC and the Params collection being:
drivername=ODBC
database=myaccessdbDSN
password=accessdbpwd
While this is great for testing, I'd rather not require an ODBC System DSN to be created for it to work.
From what I remember, a DSN can just be replaced by a ConnectionString of the correct format, and can usually be figured out by looking at the text of the DSN. Unfortunately, the Data Explorer in XE2 only works with System DSN's, and not File DSN's.
What should the ConnectionString of the TSQLConnection be when using ODBC to connect to a MS Access database file?
EDIT 1
Given a form with a databound grid, a TDataSource, a TSQLQuery with appropriate SQL command, and a private TSQLConnection (not form component), the following works:
FSQLConnection := TSQLConnection.Create(nil);
FSQLConnection.DriverName := 'ODBC';
FSQLConnection.LoginPrompt := false;
FSQLConnection.Params.Values['Database'] := 'myaccessdbDSN';
FSQLConnection.Params.Values['Password'] := 'accessdbpwd';
FSQLConnection.Connected := true;
SQLQuery1.SQLConnection := FSQLConnection;
SQLQuery1.Active := true;
I see the results of the query in the grid.
What I need to do is replace the 'myaccessdbDSN' with a connection string. If I do the following, which seems to be the way it should work, I get a "Connection Could Not Open" error from the ODBC Driver Manager.
FSQLConnection := TSQLConnection.Create(nil);
FSQLConnection.DriverName := 'ODBC';
FSQLConnection.LoginPrompt := false;
FSQLConnection.Params.Values['ConnectionString'] := 'Provider=Microsoft.ACE.OLEDB.12.0;'+
'Data Source=myaccessdb.mdb;'+
'Jet OLEDB:Database Password=accessdbpwd;';
FSQLConnection.Connected := true;
SQLQuery1.SQLConnection := FSQLConnection;
SQLQuery1.Active := true;
Please note that normally, when setting the DriverName property at runtime, you have to set some of the other properties that are normally defined in the dbxdrivers.ini file. If the DriverName is set to 'MSSQL', these are:
GetDriverFunc=getSQLDriverMSSQL
LibraryName=dbxmss.dll
VendorLib=sqlncli10.dll
But when the DriverName is set to 'ODBC', these are blank. Is this a fault with the dbxDriver for ODBC or not?
I've looked through the help at http://docwiki.embarcadero.com/RADStudio/Berlin/en/Setting_Up_TSQLConnection
but it does not tell me anything I haven't already tried, and it does fill me with confidence when the sentence
To display the Connection Editor, double-click the TSQLConnection
component.
does not work in XE2, XE5, Seattle or Berlin.
EDIT 2
The whole reason I am looking at this is because the Open ODBC dbxExpress driver no longer works in Berlin. The following will work in XE2:
FSQLConnection.DriverName := 'DbxOpenOdbc';
FSQLConnection.GetDriverFunc := 'getSQLDriverODBCW';
FSQLConnection.LibraryName := 'dbxoodbc.dll';
FSQLConnection.VendorLib := 'odbcjt32.dll';
FSQLConnection.Params.Values['DriverPackageLoader'] := 'TDBXDynalinkDriverLoaderOpenOdbc';
FSQLConnection.Params.Values['IsolationLevel'] := 'ReadCommitted';
FSQLConnection.Params.Values['RowSetSize'] := '20';
FSQLConnection.Params.Values['Database'] := '?';
FSQLConnection.Params.Values['ConnectionString'] := 'DRIVER={Microsoft Access Driver (*.mdb)};'+
'DBQ=myaccessdb.mdb;'+
'UID=;'+
'PWD=accessdbpwd;'+
'DriverId=25;'+
'FIL=MS Access;';
But when the same code is run in Berlin, I get a "Duplicates not allowed" error, from the AddCommandFactory, which is related to this code in the Dbx34Drv unit, as below:
constructor TDbxOpenOdbcDriver.Create(DriverDef: TDBXDriverDef);
begin
{$IF CompilerVersion > 18.50}
inherited Create(DriverDef, TDBXDynalinkDriverLoader);
InitDriverProperties(TDBXOpenOdbcProperties.Create(DriverDef.FDBXContext));
// '' makes this the default command factory.
AddCommandFactory('', CreateCommandOpenOdbc);
//AddCommandFactory(TDBXCommandTypes.DbxMetaData
{$ELSE}
raise EDbxOODBCDriverError.Create('Not Implemented: TDbxOpenOdbcDriver.Create(DriverDef: TDBXDriverDef)');
{$IFEND}
end;
As the Open ODBC dbxExpress driver has not been maintained since 2013, and that XE2 and Berlin Enterprise come with their own ODBC dbxExpress driver (Data.DBXOdbc), I am wanting to change the properties and parameters to get the code that is working in XE2 to work with the native ODBC driver, and then check that it works in Berlin.
The thread at https://sourceforge.net/p/open-dbexpress/discussion/119359/thread/703de7d9/ indicates it should just be a matter of replacing the Open ODBC values with regular ODBC ones.
The table at http://docwiki.embarcadero.com/RADStudio/Berlin/en/DbExpress_Supported_Database_Management_Systems does not list any libraries for "Odbc", so I assume it would be blank.
EDIT 3 (AND ANSWER)
After some faffing about with the code, I have got the following to work in both XE2 Enterprise and Berlin Enterprise in order to open a MS Access database with a TSQLConnection object using the native ODBC dbxExpress driver.
FSQLConnectionAccess.DriverName := 'ODBC';
FSQLConnectionAccess.GetDriverFunc := 'getSQLDriverODBCW';
FSQLConnectionAccess.LibraryName := '';
FSQLConnectionAccess.VendorLib := 'odbcjt32.dll';
FSQLConnectionAccess.Params.Values['DriverPackageLoader'] := 'TDBXOdbcDriverLoader';
FSQLConnectionAccess.Params.Values['IsolationLevel'] := 'ReadCommitted';
FSQLConnectionAccess.Params.Values['RowSetSize'] := '20';
FSQLConnectionAccess.Params.Values['Database'] := '?';
FSQLConnectionAccess.Params.Values['ConnectionString'] := 'DRIVER={Microsoft Access Driver (*.mdb)};'+
'DBQ=myaccessdb.mdb;'+
'UID=;'+
'PWD=accessdbpwd;'+
'DriverId=25;'+
'FIL=MS Access;';
Note how the connection string used is nothing like the ones shown in http://www.connectionstrings.com, which is the main reason I don't use that site for Delphi development.
A similar change is required if you were using the DevArt SQL Server driver and want to change to the native MS SQL Server one:
// FSQLConnectionSQL.DriverName := 'DevArtSQLServer';
// FSQLConnectionSQL.GetDriverFunc := 'getSQLDriverSQLServer';
// FSQLConnectionSQL.LibraryName := 'dbexpsda40.dll';
// FSQLConnectionSQL.VendorLib := 'sqloledb.dll';
becomes
FSQLConnectionSQL.DriverName := 'MSSQL';
FSQLConnectionSQL.GetDriverFunc := 'getSQLDriverMSSQL';
FSQLConnectionSQL.LibraryName := 'dbxmss.dll';
FSQLConnectionSQL.VendorLib := 'sqlncli10.dll';
The reason we had been using Open ODBC and DevArt SQL Server drivers is that we originally had XE2 Professional, which did not include ODBC or SQL drivers as standard. Now that we are using Enterprise, that is no longer an issue. The only thing left to do is determine if the old and new drivers behave differently.
The answer to the original question on how to setup a DSN-less connection to a MS Access database in XE2 Enterprise using the ODBC driver is:
FSQLConnectionAccess.DriverName := 'ODBC';
FSQLConnectionAccess.GetDriverFunc := 'getSQLDriverODBCW';
FSQLConnectionAccess.LibraryName := '';
FSQLConnectionAccess.VendorLib := 'odbcjt32.dll';
FSQLConnectionAccess.Params.Values['DriverPackageLoader'] := 'TDBXOdbcDriverLoader';
FSQLConnectionAccess.Params.Values['IsolationLevel'] := 'ReadCommitted';
FSQLConnectionAccess.Params.Values['RowSetSize'] := '20';
FSQLConnectionAccess.Params.Values['Database'] := '?';
FSQLConnectionAccess.Params.Values['ConnectionString'] := 'DRIVER={Microsoft Access Driver (*.mdb)};'+
'DBQ=myaccessdb.mdb;'+
'UID=;'+
'PWD=accessdbpwd;'+
'DriverId=25;'+
'FIL=MS Access;';
Why not modify source?
Like below
constructor TDbxOpenOdbcDriver.Create(DriverDef: TDBXDriverDef);
begin
{$IF CompilerVersion > 18.50}
inherited Create(DriverDef, TDBXDynalinkDriverLoader);
InitDriverProperties(TDBXOpenOdbcProperties.Create(DriverDef.FDBXContext));
// '' makes this the default command factory.
//AddCommandFactory('', CreateCommandOpenOdbc);
AddCommandFactory('Dbxoodbc', CreateCommandOpenOdbc);
//AddCommandFactory(TDBXCommandTypes.DbxMetaData
{$ELSE}
raise EDbxOODBCDriverError.Create('Not Implemented: DbxOpenOdbcDriver.Create(DriverDef: TDBXDriverDef)');
{$IFEND}
end;

Firebird 2.5 embedded - 'Database name is missing' - client dll chaos

I cannot get firebird embedded server to work.
Get an exception at line
datamodule1.IBQuery1.Prepare;
".exe raised exeption class EIBClientError with message 'Database name is missing'."
(IBQuery1 is tied to IBDatabase1)
Im using the server/client dll from this package:
Firebird-2.5.3.26778-0_Win32_embed.zip (x86)
I copied the following files (as written in the firebird manual) to my application's folder:
ib_util.dll
icudt30.dll
icuin30.dll
icuuc30.dll
fbembed.dll
firebird.msg
('firebird.conf' does not have to be copied in case you are ok with firebirds default configuration.)
I renamed the fbembed.dll to gds32.dll because im using Delphi's interbase components, but tried the file names fbclient.dll and fbembed.dll also.
For IBDatabase1's 'DatabaseName' property i dont use hostname bacause its stated in the manual that you dont have to in case of using the embedded server (local XNET protocol).
I create the path in runtime, been debug this and double checked the path, its correct.
At design time i can connect to the database setting the IBDatabase1's 'Connected' parameter to 'True'. (After manually filling the 'DatabaseName' property with the correct path.)
I searched the system for other firebird client dll's (gds32.dll) and found it at four different location:
c:\Program Files (x86)\HK-Software\IBExpertLive\gds32.dll
c:\Windows\System32\gds32.dll
c:\Windows\SysWOW64\gds32.dll
c:\InCash\GDS32.DLL
It seems that the system using the one that is located in SysWOW64, but even if i replace the dll there to the embedded (fbembed.dll renamed to gds32.dll), nothing changes.
The goal would be not to touch any of the already installed dlls and environment variables/registry entries, but using the embedded dll that is bundled with my application and is located beside that, so making the deployment of the software as easy as you can get.
Some more info:
Tried to rename database XYZ.FDB to XYZ.GDB
Username and password is given at IBDatabase1's 'Params' property although its not necessary with the embedded version
Op. system: Win7 x64
I have a firebird service installed, but its been stoped
Im using Delphi's InterBase components
Datamodule1.IBQuery1 is tied to Datamodule1.IBDatabase1
The DatabaseName property of IBDatabase1 been set to 'e:\X\XYZ.FDB' by code (the path is correct, i double checked)
IDE: Delphi 2010
Was searching for similar topics but yet i could not find solution.
Connect to database:
procedure TDataModule1.DataModuleCreate(Sender: TObject);
begin
IBDatabase1 := TIBDatabase.Create(self);
//
app_path := ExtractFilePath(Application.ExeName);
//
IBDatabase1.DatabaseName := app_path + 'db\XYZ.GDB';
IBDatabase1.LoginPrompt := false;
IBDatabase1.Params.add('lc_ctype=UTF8');
IBDatabase1.Params.add('user_name=xyz'); //not necessary with embedded
IBDatabase1.Params.add('password=xyz'); //not necessary with embedded
//
IBDatabase1.Connected := true;
IBDatabase1.Open;
end;
Then trying to insert a record:
with datamodule1.IBQuery1 do
begin
close;
With SQL do
begin
clear;
Add( 'INSERT INTO MST_EVENTS (index, state, event, param, date, time, devID, gateway)' );
Add( 'VALUES :index, :state, :event, :param, :date, :time, :devid, :gateway');
end;
//
Params[0].AsInteger := FMaster.EventRecordIndex;
Params[1].AsSmallInt := FMaster.EventRecordState;
Params[2].AsString := eventToStr(FMaster.EventRecordEvent);
Params[3].AsSmallInt := 0;
Params[4].AsDate := FMaster.EventRecordDate;
Params[5].AsTime := FMaster.EventRecordTime;
Params[6].AsLongWord := FMaster.EventRecordDevID;
Params[7].AsString := FMaster.EventRecordIP;
//
if ( prepared = false ) then
prepare; //Throws the exception here
open;
end;
This line was the problem.
IBDatabase1 := TIBDatabase.Create(self);
It's totally needless, because the class instance had already been created by the datamodule 'form'.

How to connect in a firebird database in execution time?

I'm having a hard time to make my code work. I want to connect to a database with my application in Delphi 7, but if I change the folder of the application, for example, if I install in another computer, my datamodule stops working. The error is:
Raised exception class EdatabaseError with message "Missing Drivername propriety"
My actual code is:
procedure TDataModule1.DataModuleCreate(Sender: TObject);
var
conexao : TSQLConnection;
begin
with SQLConnection1 do
begin
ConnectionName := 'SKY';
DriverName := 'Interbase';
LibraryName := 'dbexpint.dll';
VendorLib := 'gds32.dll';
GetDriverFunc := 'getSQLDriverINTERBASE';
LoadParamsOnConnect := true;
LoginPrompt := False;
Params.Add('Database='+ExtractFilePath(Application.ExeName)+'\Banco\FLY_SKY_DESK.FDB');
Params.Add('User_Name=SYSDBA');
params.Add('Password=masterkey');
Params.Add('SQLDialect=3');
Open;
end;
SQLConnection1.Connected:=true;
end;
I want to connect to the database using my .exe, on any path or install location.
If you are running Windows 7 or Vista, and install your app into the "\Program files" (either one) directory, this will not work due to folder virtualization within UAC.
You should NOT attempt to place the database within the same directory that the program is running from. You will get away with it on XP and earlier. From then on, it's a no-no.
This may not be your problem, but it definitely IS a problem.
I faced a similar problem when I tried to write code which would open a Firebird database from a thread. The code looks like you are using the dbExpress TSQLConnection; it's much easier if you use the IB components, specifically TIBDatabase. Then your code becomes something like the following
var
ibdb: TIBDatabase;
qDefaults: TIBQuery;
trans: TIBTransaction;
begin
ibdb:= TIBDatabase.Create (nil);
ibdb.databasename:= ExtractFilePath(Application.ExeName)+'\Banco\FLY_SKY_DESK.FDB')
ibdb.loginprompt:= false;
ibdb.params.add ('password=masterkey');
ibdb.params.add ('user_name=sysdba');
ibdb.sqldialect:= 3;
ibdb.connected:= true;
trans:= TIBTransaction.create (nil);
trans.defaultdatabase:= ibdb;
qDefaults:= TIBQuery.create (nil);
qDefaults.database:= ibdb;
qDefaults.transaction:= trans;
qDefaults.sql.Add ('select * from defaults');
qDefaults.active:= true;
...
You are most likely missing the DLLs required on the target computer. You'll need to figure out which DLLs should be included with the client application and install them on the target computer. Often, simply placing the required DLLs in the same folder as the EXE will work.
I can't figure out quite what you're using since you reference Interbase and dbExpress and Firebird, but your target computer probably doesn't have the needed drivers.
You need to deploy:
dbxconnections.ini
dbxdrivers.ini
dbxfb.dll
fbclient.dll
midas.dll {in case you used ClientDatasSet and you didn't include MidasLib into uses clause}
after deploy all those files along with your Exe than you need to update registry entry to point to locations of dbxconnections.ini and dbxdrivers.ini my version is delphi 10.3 so the registry entry are located in
HKEY_CURRENT_USER > Software > Embarcadero > BDS > 20.0 > DBExpress
Connection Registry File value is the path to dbxconnections.ini
Driver Registry File value is the path to dbxdrivers.ini

Delphi 2010: Firebird dbExpress Error Unable to load dbxfb4d14.dll

I just downloaded the dbExpress Driver for Firebird by Chee-Yang Chau from this google code site.
I loaded the Delphi 2010 demo projects and tried running it and immediatedly got a could not load dll error:
INI File
[Installed Drivers]
FirebirdConnection=1
[FirebirdConnection]
;DriverUnit=DBXInterBase
;DriverPackageLoader=TDBXDynalinkDriverLoader,DbxCommonDriver120.bpl
;DriverAssemblyLoader=Borland.Data.TDBXDynalinkDriverLoader,Borland.Data.DbxCommonDriver,Version=12.0.0.0,Culture=neutral,PublicKeyToken=91d62ebb5b0d1b1b
;MetaDataPackageLoader=TDBXInterbaseMetaDataCommandFactory,DbxInterBaseDriver120.bpl
;MetaDataAssemblyLoader=Borland.Data.TDBXInterbaseMetaDataCommandFactory,Borland.Data.DbxInterBaseDriver,Version=12.0.0.0,Culture=neutral,PublicKeyToken=91d62ebb5b0d1b1b
GetDriverFunc=getSQLDriverFIREBIRD
LibraryName=dbxfb4d14.dll
VendorLib=C:\Program Files\Firebird\Firebird_1_5\bin\fbclient.dll
BlobSize=-1
CommitRetain=False
Database=database.gdb
ErrorResourceFile=
LocaleCode=0000
Password=masterkey
RoleName=RoleName
ServerCharSet=
SQLDialect=3
Interbase TransIsolation=ReadCommited
User_Name=sysdba
WaitOnLocks=True
Trim Char=False
Delphi Code
procedure TMainForm.Button1Click(Sender: TObject);
var C: TSQLConnection;
begin
C := TSQLConnection.Create(Self);
try
C.DriverName := 'FirebirdConnection';
// C.LibraryName := 'dbxufb40.dll';
// C.VendorLib := 'C:\Program Files\Firebird\Firebird_1_5\bin\fbclient.dll';
// C.GetDriverFunc := 'getSQLDriverFIREBIRD';
C.Params.Add('User_Name=SYSDBA');
C.Params.Add('Password=masterkey');
C.Params.Add('Database=localhost:%ProgramFiles%\Firebird\Firebird_1_5\examples\employee.fdb');
C.Open;
if C.Connected then
ShowMessage('Connection is active')
finally
C.Free;
end;
end;
I noticed that the library name dbxfb4d14.dll in the ini file did not match the actual dll name dbxfb4d15.dll so I modified the ini file so it would match the name of the dll.
Now I get an error saying the dbxfb4d15.dll cannot be found.
What am I doing wrong?
You do need the d14 version for Delphi 2010. The d15 version is for XE. Not sure why there is only the d15 version in the zip.
The DLL is not located on your DLL search path. Once you get hold of the right DLL then you need to make sure it's on the path.
Having browsed around this component I'm not convinced it's terribly polished. If you can afford it, the Devart drivers come highly recommended.

Resources