FirebirdSQL / firebird

Firebird server, client and tools
https://www.firebirdsql.org/
1.23k stars 212 forks source link

Add EMBEDDED connection option that will accept only embedded connection to the DB #7787

Open TommiPrami opened 11 months ago

TommiPrami commented 11 months ago

like EMBEDDED:C:\Data\MyDatabase.fdb

We have had issues when we try to connect to the DB with embedded, we get error of XNET. There seems to be situations when engine chooses to use XNET if no server given.

I do not have reproducible case, but this has happened few times over a year or so, and that's why had to add unique IPC-names to the Firebird.conf to prevent this to happen (If I recall). If I remember it was due the we had 2.5 server running on the machine and tried to connect with 4.0.x embedded instead. (or something on those lines)

Having way to force embedded connection and if there is no sufficient Embedded libraries present, I would get error: "EMBEDDED connection is not possible, because someone forgot to give me enough libraries" (or something similar)

I think this would make connecting to the Firebird a bit more deterministic, and in this case I would be sure that XNET connection would never happen.

hvlad commented 11 months ago

One may use isc_dpb_config in DPB with contents like "Providers=EngineXX" at client side to force usage of embedded provider only. Where XX is the version number of corresponding Firebird engine (12 for FB3, 13 for FB4 and FB5).

Or, XNET listener could be not enabled at server side using command line switch -i (enables INET protocol only), if required.

While this ticket is definitely support question, I recommend to consider it as feature request as people asked for "embedded only connection" many times in the past.

TommiPrami commented 11 months ago

"While this ticket is definitely support question"

Not intended as one, sorry if it comes out as this way, was intended as feature request.

I would like to have way to force embedded connection on the client side, to make sure I use specific set of embedded libraries, and not the server installed on the system.

So it would be embedded connection to the DB or nothing at all (or something, in form of an error).

mrotteveel commented 11 months ago

I would like to have way to force embedded connection on the client side, to make sure I use specific set of embedded libraries, and not the server installed on the system.

And as Vlad mentions, you can achieve that by passing isc_dpb_config with value Providers=engineXX. The only downside of that solution is that you need to know the actual engine version to connect.

TommiPrami commented 11 months ago

I think that DAC we are using would not support that.

So to add EMBEDDED (As "server") to the "connection string thingy" would be supported all DAC-components, I think.

dyemanov commented 11 months ago

5466 ?

TommiPrami commented 11 months ago

Issue I filed Seems to be duplicate.

Did not think there could be situation that there could be embedded libraries present but would NOT like to use Embedded connection. Might be good to have that option also, possibly, maybe...

hvlad commented 11 months ago

I think that DAC we are using would not support that.

Did you ask the DAC authors about it ? Does the DAC provides generic methods to add clumplets into DPB, or they uses named methods for every known to it tag only ?

sim1984 commented 11 months ago

I have a problem in a similar area, but not exactly. When I made my own provider for connecting to MySQL / ODBC via EXECUTE STATEMENT ON EXTERNAL, it was necessary to somehow mark that the connection should occur through my provider. Now we are enumerating providers in the order of their entry in Providers from Firebird.conf. The problem is that if there is an authorization error with my provider or another error connecting to the database, the system silently moves on to the next provider and the original error is overwritten. It would be nice to have some way of indicating to only use a given provider and not try others.

I'm not sure that this problem should be solved only through the connection string.

As for the author, maybe we can give the ability to set some parameters in the connection string in a similar style URL? In this case, after the main connection line there is a question mark and a set of parameter values = separated by an ampersent. Example:

/var/db/mydatabase.fdb?providers=engine12