native vs IBX lazarus / 16-Databases ---------------------------------------------------------------------- calm_sea · 2024-01-04 13:26 I'm porting in network a Lazarus + Firebird application, that I wrote in embedded mode (localhost only) and it works well. Since I have some deadlock problems with transactions, while studying your posts in this forum, I discovered about IBX components. Can you tell me in summary what advantages it brings compared to just the components already in the IDE? Does using them have a high impact such as changes I need to make? Is the license free? ---------------------------------------------------------------------- marcov · 2024-01-04 13:42 The native components are cross database, IBX is firebird only, and reasonably free (read the license). IBX originally was a Delphi component, the native components were developed in lockstep with Lazarus/FPC. As an alternative to both, there is also ZEOSDBO, which supports both Delphi and Lazarus and multiple databases. I'm a PostGreSQL user, so I can't tell about the practical advantages of IBX. ---------------------------------------------------------------------- tonyw · 2024-01-04 13:43 I assume that when you mean "native" you mean SQLite and the clue should be in the name. SQLite provides a simple and, I believe, lightweight framework for several database drivers - not just Firebird. On the other hand, IBX is intended to provide full and optimised access to the Firebird API and is very specific to Firebird. If all you need is to run a few generic queries and don't really want to get into SQL and the specifics of database applications, then SQLite should be sufficient. If you want to fully exploit Firebird then you should consider IBX. Historically, IBX came with Delphi as an embedded database driver for InterBase. At the time, your alternatives were the middleware Borland Database Engine (BDE) or direct access to Paradox tables. When Borland put InterBase into the public domain, it also release IBX under the same InterBase Public Licence (IPL). InterBase became Firebird and IBX was ported to Lazarus. The IPL is very permissive and allows both commercial and non-commercial use - unlike the GPL. ---------------------------------------------------------------------- rvk · 2024-01-04 14:13 Quote from: tonyw on January 04, 2024, 02:43:02 pmI assume that when you mean "native" you mean SQLite and the clue should be in the name. SQLite provides a simple and, I believe, lightweight framework for several database drivers - not just Firebird. You probably mean SQLdb (instead of SQLite)  SQLdb is default installed in Lazarus. SQLite (3) is just one of the possible databases in SQLdb. ---------------------------------------------------------------------- calm_sea · 2024-01-04 14:17 I didn't mean sqlite. I developed using the IBconnection component of the Lazarus SQLdb palette and then, in cascade, SQL_Transaction, SQL_Query, etc. Also RXdbAware in some cases. Everything works fine, except for some deadlocks that I'm investigating. I was asking what the cost-benefit are if I switch to IBX or ZEOS ---------------------------------------------------------------------- rvk · 2024-01-04 14:25 As said in my previous post... when reading the post from tony... where SQLite = read SQLdb Quote from: calm_sea on January 04, 2024, 03:17:16 pmI was asking what the cost-benefit are if I switch to IBX or ZEOS In Delphi I use IBX. Switching from there would be easy. I have looked at ZEOS in the past and was put down because of the ONE transaction per DB connection (not sure if that's still the case). If you are heavily into multiple transactions (rollback, commit, snapshots and savepoints) then I don't think ZEOS is a good match. If Firebird is the only database you are using, then IBX should work fine. But your transaction problem is probably design/flow related over component-choice related. ---------------------------------------------------------------------- calm_sea · 2024-01-04 15:06 OK, for now I'll continue to use SQLdb. Maybe in the future I'll try IBX. Thank you all ---------------------------------------------------------------------- calm_sea · 2024-01-05 11:41 The good and bad thing about programming is that we can't resist something new I thought about making a maintenance module to run only on the server using IBX. The problem is that when it is active, other PCs (with the application with sqldb) say that the fdb file is in use by another process ---------------------------------------------------------------------- rvk · 2024-01-05 12:28 Quote from: calm_sea on January 05, 2024, 12:41:45 pmI thought about making a maintenance module to run only on the server using IBX. The problem is that when it is active, other PCs (with the application with sqldb) say that the fdb file is in use by another processMake sure that you don't mix embedded version and server version with the same database. A Firebird database can only be opened by ONE embedded connection (and it's locked) or by ONE server instance (in which case you can connect multiple clients to it at the same time). So you need to point the "other PCs" with the connection string to the server version. ---------------------------------------------------------------------- calm_sea · 2024-01-05 18:54 Yes, you're right, that was the problem. But on the module with IBX (on the server) the connection with the server in the string does not work. But there is something even stranger. I tried different connection string syntax. What happens is that the error message always indicates the first string that caused the error, not the current one. I also tried making an empty application, inserting only the IBdatabase component, the database name and ticking connected. The old string always appears, even if I close and restart Lazarus and create new project and stop and restart Firebird. Seems have it in some cache or similar. I use Lazarus 3.0 and I installed IBX via online package manager (which the warning: not tested) ---------------------------------------------------------------------- rvk · 2024-01-05 19:24 Quote from: calm_sea on January 05, 2024, 07:54:49 pmThe old string always appears, even if I close and restart Lazarus and create new project and stop and restart Firebird. What do you mean, the old string appears? I normally never ever connect via the IDE. But if you do, you need to be aware that when you want to connect at runtime (and set the db/connection string in code), you need to set the connected (and any active) property to false. Otherwise the components get connected at start (before your code) and you can't change database anymore. (That's why I normally also leave the connection string empty so I have to set it through code.) ---------------------------------------------------------------------- calm_sea · 2024-01-05 20:04 yes, I know what you're saying, but to understand what was happening and make quick tests I started testing also with an empty project and connecting from the IDE. Tomorrow I'll do some more clean tests and I'll update you. however I forgot to tell you that I have the server in a virtualbox, I will also check the parameters of the VM ---------------------------------------------------------------------- calm_sea · 2024-01-06 10:46 I have made a new, standard, clean installation of Firebird (before it was custom install and the dir with the db was shared!   ). After many tests, I understood that: if the first application that attaches to the DB is the local one with IBX, access becomes exclusive (like embedded). If the first connect is the remote client application (with sqldb) and after I launch the one with IBX, everything works OK. NB I use the ipaddress:path syntax, the syntax with inet and xnet does not work ---------------------------------------------------------------------- rvk · 2024-01-06 11:09 Quote from: calm_sea on January 06, 2024, 11:46:57 amAfter many tests, I understood that: if the first application that attaches to the DB is the local one with IBX, access becomes exclusive (like embedded). If the first connect is the remote client application (with sqldb) and after I launch the one with IBX, everything works OK. I don't understand what you mean by 'local one'. It's really simple... Just one process can access a DB. It doesn't matter if that's with IBX or SQLdb. They work the same. Firebird server counts as one process (so you can have multiple clients connect to that server process but you can only have one server). If either the server or an embedded instance has a connection to the DB then no other process can connect to it (server or embedded). So if you have a server on 192.168.1.1, any client (including the one on that server itself) can connect randomly to that server. The server itself could also use the 127 or localhost notation. If your experience is different maybe you can elaborate by explaining exactly what connectionstring (and fb-instance) you used in each client. ---------------------------------------------------------------------- egsuh · 2024-01-06 12:58 I haven‘t used IBX much but it seems to have some specific features only available to Firebird (or  Interbase), which may not be possible with SQLDB(not sure).  But SQLDB jas its own merits, like saving directly to and from TBufdatabase. So it is easy to simulate briefcase model.