Firebird Embedded and Lazarus
Moderators: gto, cipto_kh, EgonHugeist
-
- Fresh Boarder
- Posts: 15
- Joined: 09.08.2007, 21:54
Firebird Embedded and Lazarus
I'm trying to run Firebird Embedded in a Lazarus application.
object ZConnection1: TZConnection
Protocol = 'firebird-2.0'
Database = 'C:\Photography\Software\Lazarus\RAKPHOTODB.FDB'
In design mode, when I set the Connected property to True, I get a message that says 'None of the dynamic libraries can be found: Fbclient20.dll ; FbClient.dll'
Both dll's are in the same directory as the fdb.
What am I missing?
thanks,
bob k.
object ZConnection1: TZConnection
Protocol = 'firebird-2.0'
Database = 'C:\Photography\Software\Lazarus\RAKPHOTODB.FDB'
In design mode, when I set the Connected property to True, I get a message that says 'None of the dynamic libraries can be found: Fbclient20.dll ; FbClient.dll'
Both dll's are in the same directory as the fdb.
What am I missing?
thanks,
bob k.
- mdaems
- Zeos Project Manager
- Posts: 2766
- Joined: 20.09.2005, 15:28
- Location: Brussels, Belgium
- Contact:
A few things, I think...
- Embedded : use the firebirdd-2.0 protocol.
- To make a distinction between client/server version and embedded we advise to call the embedded lib fbclientd20.dll. This way you can mix embedded databases and CS databases without trouble.
- The dll's should be in the same dir as your exe OR in the system path. Beware : when connecting in the IDE your path usually is NOT the path were your project is but where your IDE is.
Mark
- Embedded : use the firebirdd-2.0 protocol.
- To make a distinction between client/server version and embedded we advise to call the embedded lib fbclientd20.dll. This way you can mix embedded databases and CS databases without trouble.
- The dll's should be in the same dir as your exe OR in the system path. Beware : when connecting in the IDE your path usually is NOT the path were your project is but where your IDE is.
Mark
-
- Fresh Boarder
- Posts: 15
- Joined: 09.08.2007, 21:54
-
- Fresh Boarder
- Posts: 15
- Joined: 09.08.2007, 21:54
- mdaems
- Zeos Project Manager
- Posts: 2766
- Joined: 20.09.2005, 15:28
- Location: Brussels, Belgium
- Contact:
Yes, you have to rename.
See ZPlainFirebird20 :
And ZPlainFirebirdDriver
Finally here's the loading logic in ZPlainFirebird20
Mark
See ZPlainFirebird20 :
Code: Select all
const
WINDOWS1_DLL_LOCATION = 'fbclient20.dll';
WINDOWS1_DLL_LOCATION_EMBEDDED = 'fbclientd20.dll';
LINUX1_DLL_LOCATION = 'libfbclient.so.20';
LINUX1_DLL_LOCATION_EMBEDDED = 'libfbembed.so.20';
LINUX1_IB_CRYPT_LOCATION = 'libcrypt.so.20';
Code: Select all
const
WINDOWS2_DLL_LOCATION = 'fbclient.dll';
WINDOWS2_DLL_LOCATION_EMBEDDED = 'fbclientd.dll';
LINUX2_DLL_LOCATION = 'libfbclient.so';
LINUX2_DLL_LOCATION_EMBEDDED = 'libfbembed.so';
LINUX2_IB_CRYPT_LOCATION = 'libcrypt.so';
Code: Select all
initialization
{$IFNDEF UNIX}
LibraryLoader := TZFirebirdNativeLibraryLoader.Create(
[WINDOWS1_DLL_LOCATION
{$IFNDEF FIREBIRD_STRICT_DLL_LOADING}
, WINDOWS2_DLL_LOCATION
{$ENDIF}
]);
LibraryLoaderEmbedded := TZFirebirdNativeLibraryLoader.Create(
[WINDOWS1_DLL_LOCATION_EMBEDDED
{$IFNDEF FIREBIRD_STRICT_DLL_LOADING}
,WINDOWS2_DLL_LOCATION_EMBEDDED
{$ENDIF}
]);
{$ELSE}
{$IFDEF ENABLE_INTERBASE_CRYPT}
LibraryLoader := TZFirebirdNativeLibraryLoader.Create(
[LINUX1_IB_CRYPT_LOCATION
{$IFNDEF FIREBIRD_STRICT_DLL_LOADING}
, LINUX2_IB_CRYPT_LOCATION
{$ENDIF}
],[LINUX1_DLL_LOCATION
{$IFNDEF FIREBIRD_STRICT_DLL_LOADING}
,LINUX2_DLL_LOCATION
{$ENDIF}
]);
LibraryLoaderEmbedded := TZFirebirdNativeLibraryLoader.Create(
[LINUX1_IB_CRYPT_LOCATION
{$IFNDEF FIREBIRD_STRICT_DLL_LOADING}
,LINUX2_IB_CRYPT_LOCATION
{$ENDIF}
], [LINUX1_DLL_LOCATION_EMBEDDED
{$IFNDEF FIREBIRD_STRICT_DLL_LOADING}
,LINUX2_DLL_LOCATION_EMBEDDED
{$ENDIF}
]);
{$ELSE}
LibraryLoader := TZFirebirdNativeLibraryLoader.Create(
[LINUX1_DLL_LOCATION
{$IFNDEF FIREBIRD_STRICT_DLL_LOADING}
,LINUX2_DLL_LOCATION
{$ENDIF}
]);
LibraryLoaderEmbedded := TZFirebirdNativeLibraryLoader.Create(
[LINUX1_DLL_LOCATION_EMBEDDED
{$IFNDEF FIREBIRD_STRICT_DLL_LOADING}
,LINUX2_DLL_LOCATION_EMBEDDED
{$ENDIF}
]);
{$ENDIF}
{$ENDIF}
-
- Fresh Boarder
- Posts: 15
- Joined: 09.08.2007, 21:54
-
- Fresh Boarder
- Posts: 15
- Joined: 09.08.2007, 21:54
-
- Fresh Boarder
- Posts: 15
- Joined: 09.08.2007, 21:54
- mdaems
- Zeos Project Manager
- Posts: 2766
- Joined: 20.09.2005, 15:28
- Location: Brussels, Belgium
- Contact:
Please use some tool to check exactly which dll's are loaded by which process.
I think two different dll's are loaded. My 'thinking path' :
- Lazarus : loads the right one.
- Lazarus + runtime ('already used' scenario) : Lazarus' dll = OK and accesses DB. Runtime's dll = wrong version and can't access the lib as it's an other file.
- Runtime : wrong dll.
If this isn't the problem, I have no idea. My FB experience is quite limited.
Mark
I think two different dll's are loaded. My 'thinking path' :
- Lazarus : loads the right one.
- Lazarus + runtime ('already used' scenario) : Lazarus' dll = OK and accesses DB. Runtime's dll = wrong version and can't access the lib as it's an other file.
- Runtime : wrong dll.
If this isn't the problem, I have no idea. My FB experience is quite limited.
Mark
-
- Fresh Boarder
- Posts: 15
- Joined: 09.08.2007, 21:54
-
- Fresh Boarder
- Posts: 15
- Joined: 09.08.2007, 21:54
- mdaems
- Zeos Project Manager
- Posts: 2766
- Joined: 20.09.2005, 15:28
- Location: Brussels, Belgium
- Contact:
- No, the file is not included into the executable. You'll have your exe, dll, fdb and some other files (eg. firebird.msg) that have to be available at runtime. So you'll always have the possibility to copy your data file or replace it by an other one. Even upgrading the dll is possible without recompiling your program. What firebird specific files you need you'll have to check with fb docs.
- Is it possible there's need for authentication for the database file? Did you make the database yourself using default values? Try sysdba/masterkey as user/password.
Mark
- Is it possible there's need for authentication for the database file? Did you make the database yourself using default values? Try sysdba/masterkey as user/password.
Mark
-
- Fresh Boarder
- Posts: 15
- Joined: 09.08.2007, 21:54