Multiple connections to the same DB

292 views
Skip to first unread message

Bennie Coetzer

unread,
Jun 4, 2021, 4:46:39 AM6/4/21
to firebird-support
Good day.  I need to connect to the same DB from multiple applications but when making a connection it always fails, stating that the file is busy.  I was sure this was supposed to be possible but I don't know where to search for the problem.
Some assistance/guidance will be appreciated.

Mark Rotteveel

unread,
Jun 4, 2021, 4:53:08 AM6/4/21
to firebird...@googlegroups.com
On 2021-06-04 10:32, Bennie Coetzer wrote:
> Good day. I need to connect to the same DB from multiple applications
> but when making a connection it always fails, stating that the file is
> busy. I was sure this was supposed to be possible but I don't know
> where to search for the problem.

This generally means that you are creating connections with Firebird
Embedded which operates in SuperServer mode, or one of your applications
is connecting through a Firebird server in SuperServer mode, and other
applications are attempting to connect through Firebird Embedded.
SuperServer mode requires exclusive access to the database file. So you
need to make sure that all your applications are connecting through the
same Firebird server (by specifying the host name as part of the
connection string), or - assuming you're using Firebird 3 or higher -
you need to configure your Firebird Embedded instances to work in
Classic or SuperClassic mode, see also
https://www.firebirdsql.org/file/documentation/release_notes/html/en/3_0/rlsnotes30.html#rnfb30-engine-architecture

Mark

liviuslivius

unread,
Jun 4, 2021, 7:42:21 AM6/4/21
to firebird...@googlegroups.com
Make sure that all connections are with ip or hostname eg.
127.0.0.1/3050:d:\database.fdb

Regards,
Karol Bieniaszewski


-------- Oryginalna wiadomość --------
Od: Bennie Coetzer <benni...@gmail.com>
Data: 04.06.2021 10:46 (GMT+01:00)
Do: firebird-support <firebird...@googlegroups.com>
Temat: [firebird-support] Multiple connections to the same DB

Good day.  I need to connect to the same DB from multiple applications but when making a connection it always fails, stating that the file is busy.  I was sure this was supposed to be possible but I don't know where to search for the problem.
Some assistance/guidance will be appreciated.

--
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/bd88093b-d6b2-4eed-b692-2c97961a1f31n%40googlegroups.com.

Martijn Tonies (Upscene Productions)

unread,
Jun 4, 2021, 4:44:00 PM6/4/21
to firebird...@googlegroups.com
Hello Bennie,
 
How do you connect, what is your ‘connect string’? Your server & file specification?
 
With regards,

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

Database Workbench - developer tool for Oracle, MS SQL Server, PostgreSQL,
SQL Anywhere, MySQL, InterBase, NexusDB and Firebird.

Bennie Coetzer

unread,
Jun 7, 2021, 1:46:35 PM6/7/21
to firebird...@googlegroups.com
Good day and thank you all for responding.
My connections are created as follows

      DBConnex := TFDConnection.Create(nil);
      try
        DBConnex.DriverName := 'FB';
        DBConnex.Params.Add('Database=' + FileTag);
        DBConnex.Params.Add('User_Name=' + PAIEUSER);
        DBConnex.Params.Add('Password=' + PAIEPASSWORD);
        DBConnex.Params.Add('DriverID=FB');
        DBConnex.Params.Add('CharacterSet=UNICODE_FSS');
        DBConnex.LoginPrompt := false;
        if NOT fileexists(FileTag) then
          DBConnex.Params.Add('CreateDatabase=yes')
        else
          DBConnex.Params.Add('CreateDatabase=no');
        try
          DBConnex.open;
          result := true;
        except
          on E: Exception do
          begin
             MessageDlg(NewDBName +  'Database connection failure - call system administrator. ' +    #13 + #10 + 'Error Message: ' + E.Message, mtWarning, [mbOK], 0);
             exit;
          end;
        end;
      finally

      end;

I use FDPhysFBDriverLink to set the vendorlib to fbclient.dll

I hope this helps
Regards
Bennie

You received this message because you are subscribed to a topic in the Google Groups "firebird-support" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/firebird-support/06AZoNvMF-k/unsubscribe.
To unsubscribe from this group and all its topics, send an email to firebird-suppo...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/firebird-support/B66D59C4040C44FEB49C8E35686EB42B%40MARTIJNWS.

Karol Bieniaszewski

unread,
Jun 7, 2021, 5:01:02 PM6/7/21
to firebird...@googlegroups.com

You forgot about e.g.:

 

Add(‘Protocol=TCPIP');

Add(‘Server=127.0.0.1');

Add(‘Port=3050’);

 

Regards,

Karol Bieniaszewski

Bennie Coetzer

unread,
Jun 8, 2021, 3:04:30 AM6/8/21
to firebird-support
Hi Karol
Thank you very much - when looking at the visible component, these fields (for a FiredacConnection) are not visible unless you select the DriverID=FB, which I did not do on quick investigation so I missed them.  The strange thing is that I could open and edit databases using a single application, in spite of this omission.
Nevertheless, a quick test seems to work now, so your assistance is much appreciated.
regards
Bennie

Reply all
Reply to author
Forward
0 new messages