Delphi Client-Server Application using Firebird 2.5 embedded connection error

前端 未结 1 749
离开以前
离开以前 2021-01-13 02:03

I have got a lengthy question to ask. First of all Im still very new when it comes to Delphi programming and my experience has beem mostly developing small single user datab

1条回答
  •  终归单人心
    2021-01-13 02:48

    Embedded can't be used by multiple users at the same time (even if it's two applications on the same machine). See here for information on the differences between the three versions. There's also information in another SO question that might help.

    As far as specifying a server at runtime, this may help:

    procedure TForm1.Button1Click(Sender: TObject);
    var 
     Conn: TSQLConnection;
    begin
      Conn := TSQLConnection.Create(Self);
      try
        Conn.DriverName := 'FirebirdConnection';
        Conn.Params.Add('User_Name=SYSDBA');
        Conn.Params.Add('Password=masterkey');
    
        // Replace the dbname in the next line with the
        // value obtained at runtime, as  in
        // Conn.Params.Add('Database=' + YourNewPathAndDBName);
        Conn.Params.Add('Database=C:\FireBirdData\YourDB.fdb');
    
        Conn.Open;
        if Conn.Connected then
          ShowMessage('Connection successfully made to DB');
      finally
        Conn.Free;
      end;
    end;
    

    0 讨论(0)
提交回复
热议问题