It is possible bypass de embedded engine?

13 views
Skip to first unread message

basura de charly

unread,
Aug 2, 2022, 3:21:53 AMAug 2
to firebird-support
That is, what I want is that if I send a connection request to a database with a url type server:database, the embedded engine should ignore it and let the server engine take care of it.
Is it possible?

Mark Rotteveel

unread,
Aug 2, 2022, 3:26:58 AMAug 2
to firebird...@googlegroups.com
Which Firebird version are you using?

Assuming Firebird 3.0 or higher, if you use an URL with server:database,
it is automatically forwarded to the server, assuming you have the
default configuration for Providers in firebird.conf for the embedded
engine of your application (that is Providers = Remote,Engine12,Loopback).

So the behaviour you want should be the default.

Mark
--
Mark Rotteveel

bdecharly

unread,
Aug 2, 2022, 3:42:11 AMAug 2
to firebird...@googlegroups.com

Yes, that's right, is forwarded and take the database properties, but the engine that is controlling it is the embedded and so, for example, block the file and take exclusive access to it.

I know I can (I should) change the embedded to Classic and so it take its own thread, but in this case, the behaviour of the database is not exactly the same as is one thread controlled by the server.

Both, the embedded and the server side are Firebird 3.0

Juan C.

Elmar Haneke

unread,
Aug 2, 2022, 3:44:37 AMAug 2
to firebird...@googlegroups.com
Usually this is done by default - embedded engine does also contain the
client lib.

Am 02.08.22 um 00:29 schrieb basura de charly:
> That is, what I want is that if I send a connection request to a
> database with a url type server:database, the embedded engine should
> ignore it and let the server engine take care of it.
> Is it possible? --

Mark Rotteveel

unread,
Aug 2, 2022, 3:45:37 AMAug 2
to firebird...@googlegroups.com
On 02-08-2022 09:42, bdecharly wrote:
> Yes, that's right, is forwarded and take the database properties, but
> the engine that is controlling it is the embedded and so, for example,
> block the file and take exclusive access to it.

Then it isn't forwarded to the server, which suggests you have a custom
configuration for Providers, or your connection string is not actually
server:database, but just database.

> I know I can (I should) change the embedded to Classic and so it take
> its own thread, but in this case, the behaviour of the database is not
> exactly the same as is one thread controlled by the server.
>
> Both, the embedded and the server side are Firebird 3.0

What is the configuration of Providers in the firebird.conf of your
embedded process?

Mark
--
Mark Rotteveel

Elmar Haneke

unread,
Aug 2, 2022, 3:48:10 AMAug 2
to firebird...@googlegroups.com

> Yes, that's right, is forwarded and take the database properties, but
> the engine that is controlling it is the embedded and so, for example,
> block the file and take exclusive access to it.
>

Usually server should be configured in a way that client processes do
not have access to database files at OS level.


Elmar

bdecharly

unread,
Aug 2, 2022, 4:02:23 AMAug 2
to firebird...@googlegroups.com
El 02/08/2022 a las 9:45, Mark Rotteveel escribió:
On 02-08-2022 09:42, bdecharly wrote:
Yes, that's right, is forwarded and take the database properties, but the engine that is controlling it is the embedded and so, for example, block the file and take exclusive access to it.

Then it isn't forwarded to the server, which suggests you have a custom configuration for Providers, or your connection string is not actually server:database, but just database.
The connection string is "DESKTOP-FA13C2/3050:C:\Users\JC\Documents\Facturacion\FACTURACION.FDB", but I've tried too "DESKTOP-FA13C2:facturacion" with "facturacion = C:\Users\JC\Documents\Facturacion\FACTURACION.FDB" in server side databases.conf and the result is the same


I know I can (I should) change the embedded to Classic and so it take its own thread, but in this case, the behaviour of the database is not exactly the same as is one thread controlled by the server.

Both, the embedded and the server side are Firebird 3.0

What is the configuration of Providers in the firebird.conf of your embedded process?

I've tried the default configuration, and also just "Providers = Remote" in the firebird.conf file.

Also I've tried "ServerMode = SuperClassic" and "ServerMode = Classic"

Regards

Juan C.


Martijn Tonies (Upscene Productions)

unread,
Aug 2, 2022, 4:08:04 AMAug 2
to firebird...@googlegroups.com
Hello Juan,
 
Perhaps I don’t understand --
 
What do you mean by ‘exclusive access to it’?
 
Do you mean that additional connections, using the full connection string, cannot be created?
 
Or do you mean you cannot create additional connections without the hostname?
 
Or do you mean the file on the OS level is locked?
 
With regards,

Martijn Tonies
Upscene Productions
https://www.upscene.com

Database Workbench - developer tool for Oracle, SQL Server, PostgreSQL, MySQL, InterBase, NexusDB and Firebird.
--
You received this message because you are subscribed to the Google Groups "firebird-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebird-suppo...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/firebird-support/09ba6721-f7cb-3e91-6793-71bda7816082%40gmail.com.

Mark Rotteveel

unread,
Aug 2, 2022, 4:08:11 AMAug 2
to firebird...@googlegroups.com
On 02-08-2022 10:02, bdecharly wrote:
> El 02/08/2022 a las 9:45, Mark Rotteveel escribió:
>> On 02-08-2022 09:42, bdecharly wrote:
>>> Yes, that's right, is forwarded and take the database properties, but
>>> the engine that is controlling it is the embedded and so, for
>>> example, block the file and take exclusive access to it.
>>
>> Then it isn't forwarded to the server, which suggests you have a
>> custom configuration for Providers, or your connection string is not
>> actually server:database, but just database.
> The connection string is
> "DESKTOP-FA13C2/3050:C:\Users\JC\Documents\Facturacion\FACTURACION.FDB",
> but I've tried too "DESKTOP-FA13C2:facturacion" with "facturacion =
> C:\Users\JC\Documents\Facturacion\FACTURACION.FDB" in server side
> /databases.conf/ and the result is the same

As far as I'm aware, Engine12 (the embedded engine) wouldn't even be
able to open a database passed that way, so it would forward to the next
provider (and with the default config, it would be handled by the Remote
provider, so should never be handled by Engine12).

Also, echoing what Elmar already said, why is your client process even
able to access a database file that should be managed by the server.

>>> I know I can (I should) change the embedded to Classic and so it take
>>> its own thread, but in this case, the behaviour of the database is
>>> not exactly the same as is one thread controlled by the server.
>>>
>>> Both, the embedded and the server side are Firebird 3.0
>>
>> What is the configuration of Providers in the firebird.conf of your
>> embedded process?
>
> I've tried the default configuration, and also just "Providers = Remote"
> in the /firebird.conf/ file.
>
> Also I've tried "ServerMode = SuperClassic" and "ServerMode = Classic"

Are you sure you're modifying the *right* firebird.conf? You need to
modify the firebird.conf that is in the same directory as the
fbclient.dll that is loaded by your application.

Mark
--
Mark Rotteveel

bdecharly

unread,
Aug 2, 2022, 4:23:52 AMAug 2
to firebird...@googlegroups.com
I'll try to explain myself.

If I connect to the (server side) server  in a normal way I'm able to modify the same table by two simultaneous connections without any problem.

But if try to connect to the same database by mean of embedded engine12.dll, the connection is done perfectly with two simultaneous clients but if I try to modify the same table it freezes or crashes. That behaviour is the same as if your are connecting to a file via Engine12 ( "Providers = Engine12").

That is why I think that connection id done by embbeded nor by server side.

Regards

Juan C.

Karol Bieniaszewski

unread,
Aug 2, 2022, 4:40:12 AMAug 2
to firebird...@googlegroups.com

Simply run

SELECT * FROM MON$ATTACHMENTS

And look at e.g. MON$REMOTE_PROTOCOL

 

Regards,

Karol Bieniaszewski

bdecharly

unread,
Aug 2, 2022, 4:41:38 AMAug 2
to firebird...@googlegroups.com
El 02/08/2022 a las 10:08, Mark Rotteveel escribió:
On 02-08-2022 10:02, bdecharly wrote:
El 02/08/2022 a las 9:45, Mark Rotteveel escribió:
On 02-08-2022 09:42, bdecharly wrote:
Yes, that's right, is forwarded and take the database properties, but the engine that is controlling it is the embedded and so, for example, block the file and take exclusive access to it.

Then it isn't forwarded to the server, which suggests you have a custom configuration for Providers, or your connection string is not actually server:database, but just database.
The connection string is "DESKTOP-FA13C2/3050:C:\Users\JC\Documents\Facturacion\FACTURACION.FDB", but I've tried too "DESKTOP-FA13C2:facturacion" with "facturacion = C:\Users\JC\Documents\Facturacion\FACTURACION.FDB" in server side /databases.conf/ and the result is the same

As far as I'm aware, Engine12 (the embedded engine) wouldn't even be able to open a database passed that way, so it would forward to the next provider (and with the default config, it would be handled by the Remote provider, so should never be handled by Engine12).

Also, echoing what Elmar already said, why is your client process even able to access a database file that should be managed by the server.
According with documentation, the post ver 3.0 engine12 is able of manipulate the three kinds of connection (embedded or engine12, loopback, and remote) without a server installation


I know I can (I should) change the embedded to Classic and so it take its own thread, but in this case, the behaviour of the database is not exactly the same as is one thread controlled by the server.

Both, the embedded and the server side are Firebird 3.0

What is the configuration of Providers in the firebird.conf of your embedded process?

I've tried the default configuration, and also just "Providers = Remote" in the /firebird.conf/ file.

Also I've tried "ServerMode = SuperClassic" and "ServerMode = Classic"

Are you sure you're modifying the *right* firebird.conf? You need to modify the firebird.conf that is in the same directory as the fbclient.dll that is loaded by your application.
Yes, I'm sure. Because I wasn't totally sure, I tried the configuration via code with isc_dpb_config

Regards

Juan C.

Mark Rotteveel

unread,
Aug 2, 2022, 4:59:24 AMAug 2
to firebird...@googlegroups.com
On 02-08-2022 10:41, bdecharly wrote:
> El 02/08/2022 a las 10:08, Mark Rotteveel escribió:
>> Also, echoing what Elmar already said, why is your client process even
>> able to access a database file that should be managed by the server.
> According with documentation, the post ver 3.0 engine12 is able of
> manipulate the three kinds of connection (embedded or engine12,
> loopback, and remote) without a server installation

The version 3.0 **client** can handle multiple providers, by default,
Remote (communicate with remote server), Engine12 (database engine,
which is the same engine used by the server itself) and Loopback
(connect to a locally running Firebird server).

Each provider is tried in turn, so - by default - first Remote, if
remote can't handle it (e.g. because there is no host name), it hands it
over to Engine12, if Engine12 cannot handle it (e.g. no
plugins/engine12.dll), it hands over to Loopback, if Loopback can't
handle it (e.g. no locally running Firebird server), you get a
connection error.

You could also try to use a more explicit connection string, for example
inet://DESKTOP-FA13C2:3050/C:\Users\JC\Documents\Facturacion\FACTURACION.FDB

However, the behaviour described in your reply to Martijn, "[..] the
connection is done perfectly with two simultaneous clients but if I try
to modify the same table it freezes or crashes", doesn't sound like an
embedded engine problem (with the default config, embedded engines would
open the database with exclusive access, so multiple processes wouldn't
even be able to connect). I'm not sure what the problem actually is though.

Mark
--
Mark Rotteveel

Dimitry Sibiryakov

unread,
Aug 2, 2022, 5:51:10 AMAug 2
to firebird...@googlegroups.com
bdecharly wrote 02.08.2022 10:23:
> But if try to connect to the same database by mean of embedded engine12.dll, the
> connection is done perfectly with two simultaneous clients but if I try to
> modify the same table it freezes or crashes. That behaviour is the same as if
> your are connecting to a file via Engine12 ( "Providers = Engine12").

It sounds like a bug in your application that corrupts engine's memory.

--
WBR, SD.

Marsupilami79

unread,
Aug 2, 2022, 6:15:27 AMAug 2
to firebird...@googlegroups.com
Hello Juan,

maybe it makes sense to try the new URL style connection strings?

DESKTOP-FA13C2/3050:C:\Users\JC\Documents\Facturacion\FACTURACION.FDB
would become something like
INET://DESKTOP-FA13C2:3050/C:\Users\JC\Documents\Facturacion\FACTURACION.FDB

These connection strings were introduced with Firebird 3.0 and allow you to explicitly specify the protocol to use.

Best regards,

Jan
Reply all
Reply to author
Forward
0 new messages