Recent

Author Topic: Having trouble embedding FireBird in my Lazarus program...  (Read 3917 times)

Robert.Thompson

  • Jr. Member
  • **
  • Posts: 56
  • "A very bad coder."
    • Google Voice for Canadians
Having trouble embedding FireBird in my Lazarus program...
« 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.
Lazarus:  1.8.4  2018-11-17
FPC:   3.0.4 x86_64-linux-gtk2
System:   Kernel: 4.15.0-39-generic x86_64 bits: 64 gcc: 7.3.0 Cinnamon 3.8.9 Linux Mint 19 Tara
              Phoenix v: 11JB.M044.20100622.hkk date: 06/22/2010
Intel Core i5 M 460 (-MT-MCP-) arch: Nehalem rev.5 cache: 3072 KB
NVIDIA GeForce 310M

dsiders

  • Hero Member
  • *****
  • Posts: 1052
Re: Having trouble embedding FireBird in my Lazarus program...
« Reply #1 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
Preview Lazarus 3.99 documentation at: https://dsiders.gitlab.io/lazdocsnext

Robert.Thompson

  • Jr. Member
  • **
  • Posts: 56
  • "A very bad coder."
    • Google Voice for Canadians
Re: Having trouble embedding FireBird in my Lazarus program...
« Reply #2 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.
Lazarus:  1.8.4  2018-11-17
FPC:   3.0.4 x86_64-linux-gtk2
System:   Kernel: 4.15.0-39-generic x86_64 bits: 64 gcc: 7.3.0 Cinnamon 3.8.9 Linux Mint 19 Tara
              Phoenix v: 11JB.M044.20100622.hkk date: 06/22/2010
Intel Core i5 M 460 (-MT-MCP-) arch: Nehalem rev.5 cache: 3072 KB
NVIDIA GeForce 310M

dsiders

  • Hero Member
  • *****
  • Posts: 1052
Re: Having trouble embedding FireBird in my Lazarus program...
« Reply #3 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.
Preview Lazarus 3.99 documentation at: https://dsiders.gitlab.io/lazdocsnext

Robert.Thompson

  • Jr. Member
  • **
  • Posts: 56
  • "A very bad coder."
    • Google Voice for Canadians
Re: Having trouble embedding FireBird in my Lazarus program...
« Reply #4 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?
« Last Edit: January 02, 2019, 11:22:47 pm by Robert.Thompson »
Lazarus:  1.8.4  2018-11-17
FPC:   3.0.4 x86_64-linux-gtk2
System:   Kernel: 4.15.0-39-generic x86_64 bits: 64 gcc: 7.3.0 Cinnamon 3.8.9 Linux Mint 19 Tara
              Phoenix v: 11JB.M044.20100622.hkk date: 06/22/2010
Intel Core i5 M 460 (-MT-MCP-) arch: Nehalem rev.5 cache: 3072 KB
NVIDIA GeForce 310M

mangakissa

  • Hero Member
  • *****
  • Posts: 1131
Re: Having trouble embedding FireBird in my Lazarus program...
« Reply #5 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
Lazarus 2.06 (64b) / FPC 3.0.4 / Windows 10
stucked on Delphi 10.3.1

Robert.Thompson

  • Jr. Member
  • **
  • Posts: 56
  • "A very bad coder."
    • Google Voice for Canadians
Re: Having trouble embedding FireBird in my Lazarus program...
« Reply #6 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.

Lazarus:  1.8.4  2018-11-17
FPC:   3.0.4 x86_64-linux-gtk2
System:   Kernel: 4.15.0-39-generic x86_64 bits: 64 gcc: 7.3.0 Cinnamon 3.8.9 Linux Mint 19 Tara
              Phoenix v: 11JB.M044.20100622.hkk date: 06/22/2010
Intel Core i5 M 460 (-MT-MCP-) arch: Nehalem rev.5 cache: 3072 KB
NVIDIA GeForce 310M

Soner

  • Sr. Member
  • ****
  • Posts: 305
Re: Having trouble embedding FireBird in my Lazarus program...
« Reply #7 on: January 03, 2019, 09:21:51 pm »
Read the information under description:
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.

rvk

  • Hero Member
  • *****
  • Posts: 6109
Re: Having trouble embedding FireBird in my Lazarus program...
« Reply #8 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).

Robert.Thompson

  • Jr. Member
  • **
  • Posts: 56
  • "A very bad coder."
    • Google Voice for Canadians
Re: Having trouble embedding FireBird in my Lazarus program...
« Reply #9 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.
Lazarus:  1.8.4  2018-11-17
FPC:   3.0.4 x86_64-linux-gtk2
System:   Kernel: 4.15.0-39-generic x86_64 bits: 64 gcc: 7.3.0 Cinnamon 3.8.9 Linux Mint 19 Tara
              Phoenix v: 11JB.M044.20100622.hkk date: 06/22/2010
Intel Core i5 M 460 (-MT-MCP-) arch: Nehalem rev.5 cache: 3072 KB
NVIDIA GeForce 310M

rvk

  • Hero Member
  • *****
  • Posts: 6109
Re: Having trouble embedding FireBird in my Lazarus program...
« Reply #10 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