0

I have simple code that creates connection to Firebird (any version, from 2.5 to 5.0).

C#, x64, FbConnection, 1000 connections, all working fine:

List<FbConnection> fbList = new List<FbConnection>();
for (int i = 1; i <= 1000; i++)
{
    try
    {

        var connection = new FbConnection("User=SYSDBA;Password=masterkey;Database=localhost/3053:c:\\rollcontrol\\rollcontrol;Pooling=false; MinPoolSize=0;MaxPoolSize=2000");
        connection.Open();

        fbList.Add(connection);
        Console.WriteLine(i.ToString());

    }
    catch (Exception e)
    {
        Console.WriteLine(DateTime.Now.ToString() + ": " + e.ToString());
    }
}

C#, x64, OdbcConnection, 1000 connections, process stopping on 180 connections (no error, the process just hangs):

List<OdbcConnection> odbcList = new List<OdbcConnection>();
for (int i = 1; i <= 1000; i++)
{
    try {

        OdbcConnection DbConnection = new OdbcConnection("DSN=rollcontrol");
        DbConnection.Open();

        odbcList.Add(DbConnection);
        Console.WriteLine(i.ToString());

    } catch (Exception e) { 
        Console.WriteLine(DateTime.Now.ToString() + ": " + e.ToString());
    }
}

ODBC has a limit on the number of connections? Maybe, it is possible to increase the limit number of connections?

UPDATE

Issue fixed in Firebird ODBC Driver 3.0.16 and ODBC 2.0.6

3
  • Which Firebird ODBC driver are you using, and what version? Commented Dec 15, 2024 at 14:07
  • I tested everything possible: Firebird 2.5.9 + ODBC 2.0, Firebird 2.5.9 + ODBC 3.0, Firebird 3.0 + ODBC 2.0, Firebird 3.0 + ODBC 3.0, Firebird 4/5 + ODBC 2.0/3.0 Commented Dec 15, 2024 at 15:49
  • More info I posted to Firebird ODBC github: github.com/FirebirdSQL/firebird-odbc-driver/issues/236 Now I rollback to Firebird 2.0 + ODBC 2.0, it is more stable for me Commented Dec 15, 2024 at 15:51

1 Answer 1

3

As hashed out in the issue you reported, this is a bug in the Firebird ODBC driver that only happens with connections created by administrators (SYSDBA and users specifying the RDB$ADMIN role).

The driver tries to find out the current real user of the connection by requesting isc_info_user_names, which for administrators reports the usernames for all connections to the current database in the current server process, and not just the username for the current connection, which with a lot of connections causes a truncation, which the driver doesn't (or since your pull request, didn't) handle correctly.

As a workaround, you can do one of the following:

  1. Use a non-administrator user

  2. Use Firebird ClassicServer (specify ServerMode = Classic in firebird.conf).

    In ClassicServer mode, each connection has its own process, so the isc_info_user_names information request only reports one user, even for administrators.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.