Recent

Author Topic: IBX - Cannot keep IBDatabase connected at design time and run time (UPDATED)  (Read 962 times)

Eloir

  • New member
  • *
  • Posts: 8
I have been using IBX together with Delphi5 since 2000, and I still on this, and happy with this.
But now I am moving to Lazarus and I faced to this strange behavior:
I cannot keep IBDatabase connected at design time and run time. But...

- It works fine on Delphi 5 (design time plus runtime).
- I am able to connect two instances of FlameRobin to the same database at the same time,
  and even running FlameRobin plus Delphi5.
- In Lazarus, when I try to keep IBDatabase connected at design time and runtime, I got an exception.
  This is a known behavior and the solution, I know, is to disconnect database before compiling application.

By the tests I did, it looks like IBDatabase connects to database in a "exclusive mode", if it is possible.
Well, if IBX works fine on Delphi, I believe that it would be possible also on Lazarus.

By the way, I tried IBDatabase.AllowStreamedConnected=true, but it doesn't work.
I am now on Windows 11, and as I can remember, it did work on Windows 10.

SOLUCTION:
On a fresh install of Windows, I installed Lazarus + IBX package before installing Firebird.
In such a situation, I don't know how, Ibx is configured to work as "embedded" (I confirmed it by stopping Firebird service and running my aplication, which worked normally without Firebird).
Since I didn't figure out how to reverse this, I completely uninstalled Lazarus and installed it again.
Now it works fine.

Hope this helps somebody.

« Last Edit: May 11, 2022, 07:09:43 pm by Eloir »

tonyw

  • Sr. Member
  • ****
  • Posts: 319
    • MWA Software
Re: IBX - Cannot keep IBDatabase connected at design time and run time
« Reply #1 on: May 06, 2022, 10:33:10 am »
The first point to make is that IBX for Lazarus has evolved considerably from the version of IBX that you would have used with Delphi 5. Having said that, it should work at least as well.

Looking at the description of your problem: what is the connect string that you are using? Is it simply the filename or does it also include the server name (or localhost:). In the former case, from Firebird 3 onwards, the underlying Firebird Client will connect in embedded mode and will typically gain exclusive access to the database. In the latter case, the Firebird Client will connect as a remote user. This will allow more than one connection to the database.

If this is not your problem then look at the "employee" example and see if you still have the same problem. If not, then the way the example connects to the database may help you.

Zvoni

  • Hero Member
  • *****
  • Posts: 2300
Re: IBX - Cannot keep IBDatabase connected at design time and run time
« Reply #2 on: May 06, 2022, 11:08:49 am »
*snip*
- In Lazarus, when I try to keep IBDatabase connected at design time and runtime, I got an exception.
  This is a known behavior and the solution, I know, is to disconnect database before compiling application.
*snip*
Since IBConnection inherits from TSQLConnection:
The solution is to not connect at design time at all.
It is as it is.
IIRC, that bug has been solved, though only in Trunk ("Main") for now.
No idea if it's going to be merged into fixes
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

tonyw

  • Sr. Member
  • ****
  • Posts: 319
    • MWA Software
Re: IBX - Cannot keep IBDatabase connected at design time and run time
« Reply #3 on: May 06, 2022, 11:17:40 am »
*snip*
- In Lazarus, when I try to keep IBDatabase connected at design time and runtime, I got an exception.
  This is a known behavior and the solution, I know, is to disconnect database before compiling application.
*snip*
Since IBConnection inherits from TSQLConnection:
The solution is to not connect at design time at all.
It is as it is.
IIRC, that bug has been solved, though only in Trunk ("Main") for now.
No idea if it's going to be merged into fixes
except that this is an IBX question and TIBDatabase inherits from TCustomConnection and not TSQLConnection.

Zvoni

  • Hero Member
  • *****
  • Posts: 2300
Re: IBX - Cannot keep IBDatabase connected at design time and run time
« Reply #4 on: May 06, 2022, 11:29:20 am »
*snip*
- In Lazarus, when I try to keep IBDatabase connected at design time and runtime, I got an exception.
  This is a known behavior and the solution, I know, is to disconnect database before compiling application.
*snip*
Since IBConnection inherits from TSQLConnection:
The solution is to not connect at design time at all.
It is as it is.
IIRC, that bug has been solved, though only in Trunk ("Main") for now.
No idea if it's going to be merged into fixes
except that this is an IBX question and TIBDatabase inherits from TCustomConnection and not TSQLConnection.
Whoops.
Sorry, my bad.
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

Eloir

  • New member
  • *
  • Posts: 8
Re: IBX - Cannot keep IBDatabase connected at design time and run time
« Reply #5 on: May 06, 2022, 08:13:06 pm »
The first point to make is that IBX for Lazarus has evolved considerably from the version of IBX that you would have used with Delphi 5. Having said that, it should work at least as well.

Looking at the description of your problem: what is the connect string that you are using? Is it simply the filename or does it also include the server name (or localhost:). In the former case, from Firebird 3 onwards, the underlying Firebird Client will connect in embedded mode and will typically gain exclusive access to the database. In the latter case, the Firebird Client will connect as a remote user. This will allow more than one connection to the database.

If this is not your problem then look at the "employee" example and see if you still have the same problem. If not, then the way the example connects to the database may help you.

I am usgin simply the filename.
Sorry, I didn't find "employee" example to see another way to connect.
By the way, I have Firebird running as a server, on my computer.

tonyw

  • Sr. Member
  • ****
  • Posts: 319
    • MWA Software
Re: IBX - Cannot keep IBDatabase connected at design time and run time
« Reply #6 on: May 06, 2022, 08:20:38 pm »
The first point to make is that IBX for Lazarus has evolved considerably from the version of IBX that you would have used with Delphi 5. Having said that, it should work at least as well.

Looking at the description of your problem: what is the connect string that you are using? Is it simply the filename or does it also include the server name (or localhost:). In the former case, from Firebird 3 onwards, the underlying Firebird Client will connect in embedded mode and will typically gain exclusive access to the database. In the latter case, the Firebird Client will connect as a remote user. This will allow more than one connection to the database.

If this is not your problem then look at the "employee" example and see if you still have the same problem. If not, then the way the example connects to the database may help you.

I am usgin simply the filename.
Sorry, I didn't find "employee" example to see another way to connect.
By the way, I have Firebird running as a server, on my computer.
Then try putting "localhost:" before the filename. That will force the client to connect via the server and you should then be in multi-user mode.

Eloir

  • New member
  • *
  • Posts: 8
Re: IBX - Cannot keep IBDatabase connected at design time and run time
« Reply #7 on: May 06, 2022, 09:40:27 pm »
Putting "localhost:" before the filename does not work either.
I finally found "employees" database and I saw also how aliases should work, but I think it is not the better way.
So, by now, I will keep designing with disconnected database.
Thank you for your tips.
« Last Edit: May 06, 2022, 10:06:03 pm by Eloir »

 

TinyPortal © 2005-2018