Forum > Databases

IBX - Cannot keep IBDatabase connected at design time and run time (UPDATED)

(1/2) > >>

Eloir:
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.

tonyw:
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:

--- Quote from: Eloir on May 04, 2022, 03:41:59 pm ---*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*

--- End quote ---
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

tonyw:

--- Quote from: Zvoni on May 06, 2022, 11:08:49 am ---
--- Quote from: Eloir on May 04, 2022, 03:41:59 pm ---*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*

--- End quote ---
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

--- End quote ---
except that this is an IBX question and TIBDatabase inherits from TCustomConnection and not TSQLConnection.

Zvoni:

--- Quote from: tonyw on May 06, 2022, 11:17:40 am ---
--- Quote from: Zvoni on May 06, 2022, 11:08:49 am ---
--- Quote from: Eloir on May 04, 2022, 03:41:59 pm ---*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*

--- End quote ---
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

--- End quote ---
except that this is an IBX question and TIBDatabase inherits from TCustomConnection and not TSQLConnection.

--- End quote ---
Whoops.
Sorry, my bad.

Navigation

[0] Message Index

[#] Next page

Go to full version