Search code examples
c#ado.netfirebirdfirebird-3.0firebird-.net-provider

ADO.NET FirebirdSql.Data.FirebirdClient.FbException: "Unable to complete network request to host "


I have a pretty strange problem when trying to connect my C# program to an existing Firebird server.

First of all, this is reproducable with the default connection example from the Firebird documentation at https://github.com/FirebirdSQL/NETProvider/blob/master/Provider/docs/ado-net.md

using (var connection = new FBConnection("database=192.168.0.150:c:\\Data\\demo.fdb;user=sysdba;password=m@sterkey"))
{
    connection.Open();
    using (var transaction = connection.BeginTransaction())
    {
        using (var command = new FbCommand("select * from demo", connection, transaction))
        {
            using (var reader = command.ExecuteReader())
            {
                while (reader.Read())
                {
                    var values = new object[reader.FieldCount];
                    reader.GetValues(values);
                    Console.WriteLine(string.Join("|", values));
                }
            }
        }
    }
}

It all works fine when I am on my machine, I also can connect to a Firebird server on my coworkers PC.

But I cannot connect to the Firebird server on my other development server. I found an answer in another question and want to tell you that the server does not have internet access. https://stackoverflow.com/a/57569057/2785084

This is the exception I get:

FirebirdSql.Data.FirebirdClient.FbException: "Unable to complete network request to host " No message for error code 335544721 found."

IscException: Unable to complete network request to host " No message for error code 335544721 found. IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host

I already updated to the latest stable Version of Firebird. I can guarantee that the server is running and no firewall is blocking my connection, because when I try to connect with our old Delphi program, everything works. I also can connect using the lightweight Firebird management tool Flamerobin from Flamerobin.org, which is written in C++, I think.

When I try to connect with DBeaver I get the following message:

[SQLState:28000, ISC error code:335544472] Your user name and password are not defined. Ask your database administrator to set up a Firebird login.

I'm pretty sure that the user and password are correct. I do not use the default password, but a password with an @ sign in it, maybe it has something to do with that.

I now have 2 programs that can Connect (Delphi and C++), and two that cannot connect (C# and Java). Does anyone have any clue or tweak how to change the connection that I can connect to the server?


Solution

  • Thanks to Mark Rotteveel for the comment which got me to the solution.
    I can connect with the default password "masterkey", so it is obvious that the srp user was created with the default credentials and therefore a connection with the other credentials is not possible.

    I have to correct the users in my old server. Thanks for the hint that ADO.NET only supports srp.