Firebird Embedded & Delphi “unavailable database”
-
24-06-2021 - |
Pergunta
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?
Solução
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;
Outras dicas
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
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.