firebirdfirebird-3.0firebird-.net-provider

Firebird .NET data adapter: no messages for error message numbers


When using a Firebird 3 database (server), but connecting through a .NET library, FirebirdSql.Data.FirebirdClient (I tried V. 7.10.1 and the newest 10.3.2), I get the following error (in this example, something is wrong in my drop-constraint statement):

FirebirdSql.Data.FirebirdClient.FbException: unsuccessful metadata update
ALTER TABLE mytable failed
No message for error code 336068738 found.

I tried copying the firebird.msg file to system32 and wow64 folders. I also tried using the environment variable FIREBIRD_MSG=C:\Program Files\Firebird\Firebird_3_0\firebird.msg as stated here

It appears to be not working for any errors I can generate through wrong SQL statements.

Another error number I got, for example, is 336068731.

Code is like this:

if (DbProviderFactories.GetFactory("FirebirdSql.Data.FirebirdClient") is not FirebirdClientFactory fac)
{
    throw new InvalidOperationException("FirebirdSql.Data.FirebirdClient.dll could not be loaded.");
}

var host = "localhost";
var user = "SYSDBA";
var pass = "masterkey";
var db = $"c:/databases/DelphiIn2025QuestionmarkQuestionmark.fdb";

var bld = new FbConnectionStringBuilder
{
    Charset = "NONE",
    DataSource = host,
    Database = db,
    UserID = user,
    Password = pass,
    WireCrypt = FbWireCrypt.Enabled
};

using (var con = fac.CreateConnection() as FbConnection)
{
    if (con == null) 
    { 
        throw new InvalidOperationException("No FbConnection returned..."); 
    }

    con.ConnectionString = bld.ConnectionString;
    con.Open();

    using (var cmd = fac.CreateCommand() as FbCommand)
    {
        if (cmd == null) { throw new InvalidOperationException("No FbCommand returned..."); }
        cmd.Connection = con;

        cmd.CommandText = "alter table mytable drop constraint PK_uid";
        cmd.ExecuteNonQuery();
    }
}

Solution

  • The FirebirdSql.Data.FirebirdClient library does not use firebird.msg to get the error messages (nor does it use fbclient.dll, unless you use server type Embedded in the connection string), but instead has its own copy in IscErrorMessages.cs, and the current version does not have the error codes you mention.

    As user13964273 mentioned in the comments, the error codes are the following messages:

    The odd thing is, these are both pretty old error messages, so I actually would expect them to be already present. As such, I'm not sure why they aren't included already, so likely an incorrect filtering of error messages was performed when populating that class (or an incomplete source was used).

    I have created issue #1221 to fix this.