With my Xamarin Forms app I connect to a Firebird database on my Windows PC when I'm on the same WiFi network by the IP address. This is the connection string:
@"Server=" + ipaddress + @";User=sysdba;Password=xxxxxxxx;Pooling=false;Connection timeout=2;Database=" + ipaddress + @":C:\FirebirdSQL\Photo.FDB;Port=3050;Dialect=3;Charset=NONE;Packet Size=32767;FbServerType.Embedded;";
Everything works correctly if I enter the right IP address, but if I enter a non-existent IP address the connection loops for 2 minutes from the moment it opens and then reports that it is impossible to connect to that IP address. How can I intervene on the timeout period for invalid connection?
I tried changing the ConnectionTimeout
time to 2 seconds in firebird.conf
but it has no effect. Maybe because the request comes from an Android app?
The ConnectionTimeout
setting in firebird.conf
is irrelevant, because that only governs connections that are made with the fbclient.dll
in the same directory as the configuration file (e.g. the server acting as a client connecting to other servers). In your case, you're using the Firebird ADO.net provider (FirebirdSql.Data.FirebirdClient), which 1) doesn't use fbclient.dll
, and 2) is on a different system, so even if it did, the setting on the server would not affect your client.
The Connection timeout
property you set in your connection string is not used for controlling the timeout of the connection when you use plain Open()
on the FbConnection
. You need to use OpenAsync(...)
for it to take effect. You don't actually show code in your question, but I guess you're not using the async variant.