Lazarus

Programming => Databases => Topic started by: Robert.Thompson on January 02, 2019, 09:26:11 pm

Title: Having trouble embedding FireBird in my Lazarus program...
Post by: Robert.Thompson on January 02, 2019, 09:26:11 pm
Hello:

Using windows 10. (this time)
Downloaded  Firebird-2.5.8.27089-0_x64_embed.zip and unzipped it into my new application directory and in my C:\Lazarus directory.
Created a single table database with DBeaver that has only 2 data entries.
Created a Lazarus program that can open and view the entries.

But, when I send the exe to someone else they can't see the data and get 'cannot load default firebird clients... etc'

Does anyone know why?

Thanks,

Rob.
Title: Re: Having trouble embedding FireBird in my Lazarus program...
Post by: dsiders on January 02, 2019, 09:44:25 pm
Using windows 10. (this time)
Downloaded  Firebird-2.5.8.27089-0_x64_embed.zip and unzipped it into my new application directory and in my C:\Lazarus directory.
Created a single table database with DBeaver that has only 2 data entries.
Created a Lazarus program that can open and view the entries.

But, when I send the exe to someone else they can't see the data and get 'cannot load default firebird clients... etc'

Does anyone know why?

Did you also send the Firebird client libraries? From README_embedded.txt:

Quote
  Just copy fbembed.dll, icudt30.dll, icuin30.dll and
  icuuc30.dll into the directory with your application.
  Then rename fbembed.dll to either fbclient.dll or
  gds32.dll depending on your database connectivity software.
  Then start your application and it will use the embedded
  server as a client library and will be able to access
  local datasases. You should also copy firebird.msg and
  firebird.conf (if necessary) to the same directory.

  If external libraries are required for your application,
  then you should have them separately. Most probably, it
  will be INTL support (fbintl.dll and fbintl.conf) or UDF
  libraries. To be able to use them, you should place them
  into the directory tree which emulates the Firebird server
  one, i.e. has subdirectories like /intl or /udf:

  c:\my_app\app.exe
  c:\my_app\gds32.dll
  c:\my_app\ib_util.dll
  c:\my_app\icudt30.dll
  c:\my_app\icuin30.dll
  c:\my_app\icuuc30.dll
  c:\my_app\firebird.conf
  c:\my_app\firebird.msg
  c:\my_app\intl\fbintl.dll
  c:\my_app\intl\fbintl.conf
  c:\my_app\udf\fbudf.dll

  If you want to place the Firebird files (excluding the
  renamed fbembed.dll) in another directory, you need to
  modify your firebird.conf and set RootDirectory to the
  Firebird directory tree. Example:

  c:\my_app\app.exe
  c:\my_app\gds32.dll
  c:\my_app\ib_util.dll
  c:\my_app\icudt30.dll
  c:\my_app\icuin30.dll
  c:\my_app\icuuc30.dll
  c:\my_app\firebird.conf
  d:\fb\firebird.msg
  d:\fb\intl\fbintl.dll
  c:\fb\intl\fbintl.conf
  d:\fb\udf\fbudf.dll

  firebird.conf:
  RootDirectory = d:\fb
Title: Re: Having trouble embedding FireBird in my Lazarus program...
Post by: Robert.Thompson on January 02, 2019, 10:40:52 pm
Thanks for replying dsiders. :)

Yes, I have read and followed that but not having any luck - I will start fresh, again.

BTW, do you know what they mean by "...depending on your database connectivity software." Isn't that just Lazarus

Thanks,

Rob.
Title: Re: Having trouble embedding FireBird in my Lazarus program...
Post by: dsiders on January 02, 2019, 10:44:04 pm
BTW, do you know what they mean by "...depending on your database connectivity software." Isn't that just Lazarus

I think they're referring to the library you are using to access Firebird. And yes, that should be linked in the .EXE built with Lazarus. Unless you're using something else that requires .DLLs.
Title: Re: Having trouble embedding FireBird in my Lazarus program...
Post by: Robert.Thompson on January 02, 2019, 10:55:28 pm
Sorry for this but how do I know which library I am using? I am using: DataSource1, SQLTransaction1, SQLQuery1 & IBConnection1 - I don't know about libraries.

Also, sorry again, but once I figure out which library I am using, how do I link it in the EXE?

Rob.

Sorry, are you talking about "Dynamic-link libraries" - the .dll files?
Title: Re: Having trouble embedding FireBird in my Lazarus program...
Post by: mangakissa on January 03, 2019, 08:29:10 am
SQLdb requires a dll to communicate with a datase. Firebird has fbclient.dll or fbembed.dll to communicate.
This library should be posted in:
- the path of your program
- the path of the lazarus installation or system32.

Read this  http://wiki.lazarus.freepascal.org/SqlDBHowto to connect to your local database.
When your connecting your database, SQLdb is searcing for the library. Look also at the post of dsiders which dll you also need to get a valid communication.

When it's working, you don't want anybody else :D
Title: Re: Having trouble embedding FireBird in my Lazarus program...
Post by: Robert.Thompson on January 03, 2019, 06:25:23 pm
Yes, I have followed the setup instructions and the required files are in my app directory.

How do I know if I need to rename fbembed.dll to fbclient.dll or to gds32.dll?

Does 'embeded' mean that I do not need to include the database.fdb file when I install the app on another PC?

Thanks for any help,

Rob.

Title: Re: Having trouble embedding FireBird in my Lazarus program...
Post by: Soner on January 03, 2019, 09:21:51 pm
Read the information under description:
https://www.freepascal.org/docs-html/fcl/ibconnection/tibconnection.html (https://www.freepascal.org/docs-html/fcl/ibconnection/tibconnection.html)

You must rename fbembed.dll to fbclient.dll.

For using embedded database you must set your connections Hostname to empty, i.e.:
Ibconnection1.Hostname:='';

You don't need to copy database-dlls to lazarus folder it is enough when you put it to your application folder.

Before compiling the application set your connections, sqlquerys active state to false and set them in forms oncreate via code to true.
Title: Re: Having trouble embedding FireBird in my Lazarus program...
Post by: rvk on January 03, 2019, 09:33:43 pm
And yes, you do need the database.fdb that's your database. Or you need to create an empty database with the tables on the fly.

You don't need to copy database-dlls to lazarus folder it is enough when you put it to your application folder.
You do need the embeded database dlls in the Lazarus directory too, if your going to connect to it during designtime. But my advise would be to use the server edition on your development system and only use embedded on the actual client machines (after testing it yourself).
Title: Re: Having trouble embedding FireBird in my Lazarus program...
Post by: Robert.Thompson on January 03, 2019, 09:52:45 pm
Thanks Soner & rvk.  :)

I believe that I have it setup correctly now.

Just to be clear, "embedding" FireBird DOES NOT embed the actual FireBird database file in the EXE, right? It just embeds the FireBird Server and Client so that who ever I sent it to does not need to install FireBird.

Thanks again,

Rob.
Title: Re: Having trouble embedding FireBird in my Lazarus program...
Post by: rvk on January 03, 2019, 09:57:46 pm
Just to be clear, "embedding" FireBird DOES NOT embed the actual FireBird database file in the EXE, right? It just embeds the FireBird Server and Client so that who ever I sent it to does not need to install FireBird.
Yes, that is correct.
TinyPortal © 2005-2018