Jump to content
gkobler

Problem determining the correct Firebird server version

Recommended Posts

Posted (edited)

I have installed FB3 as a service. FB2.5, 4.0 and 5.0 are also installed, but i run these version not as a service it runs as program with different port configuration. So i can run different FB-Server versions at the same time.

 

Port

3040: FB2.5

3050: FB3.0 (default)

3060: FB4.0

3070: FB5.0

 

The follow code runs

  PROCEDURE TForm1.Button3Click(Sender: TObject);
  VAR
    FDIBInfo: TFDIBInfo;
    AVersion: TIBInfo.TVersion;
  BEGIN
    FDPhysFBDriverLink1.VendorLib := 'D:\Temp\fbclient32_500.dll';
    FDIBInfo := TFDIBInfo.Create(Self);
    FDIBInfo.Protocol:= ipLocal;
    FDIBInfo.DriverLink:= FDPhysFBDriverLink1;
    FDIBInfo.UserName:='SYSDBA';
    FDIBInfo.Password:='masterkey';
    FDIBInfo.Port:= 3070;
    FDIBInfo.GetVersion(AVersion);
    ShowMessage(AVersion.FServerStr);
  END;

But it detects the wrong Server version, the result are allways the follow

WI-V3.0.11.33703 Firebird 3.0

The code line

FDIBInfo.Port:= 3070;

has no influence on the execution. Is this possibly an error or is generally only the FB version of the installed Windows service queried?

 

Are there a better way to detect the FB-Server version?

 

I use Delphi 12.0.1

Edited by gkobler

Share this post


Link to post
1 hour ago, gkobler said:

I have installed FB3 as a service. FB2.5, 4.0 and 5.0 are also installed, but i run these version not as a service it runs as program with different port configuration. So i can run different FB-Server versions at the same time.

 

You can use instsvc.exe and run all of them as service simultaneously. When using instsvc.exe, use "-n" and create unique names for them.

Share this post


Link to post
22 minutes ago, Vandrovnik said:

You can use instsvc.exe and run all of them as service simultaneously. When using instsvc.exe, use "-n" and create unique names for them.

Thanks for that hint. Have change it, now all version runs a service

 

But unfortunately it still doesn't solve my problem

Share this post


Link to post
11 minutes ago, gkobler said:

Thanks for that hint. Have change it, now all version runs a service

 

But unfortunately it still doesn't solve my problem

What about this:

SELECT rdb$get_context('SYSTEM', 'ENGINE_VERSION') as version from rdb$database;

 

Share this post


Link to post
Just now, Vandrovnik said:

SELECT rdb$get_context('SYSTEM', 'ENGINE_VERSION') as version from rdb$database;

How can i use this without to connect to a specify database?

Share this post


Link to post
4 minutes ago, gkobler said:

How can i use this without to connect to a specify database?

I guess you cannot.

Share this post


Link to post

Stupid... the other solution would basically work, but it doesn't pay attention to the port

Share this post


Link to post

Did you try to change the fbclient library? In you example I suppose you are using the v3.

Share this post


Link to post
1 hour ago, Ruslan said:

Did you try to change the fbclient library? In you example I suppose you are using the v3.

I use the FB5 dll 32bit version.

FDPhysFBDriverLink1.VendorLib := 'D:\Temp\fbclient32_500.dll';

FB3 would be the follow

FDPhysFBDriverLink1.VendorLib := 'D:\Temp\fbclient32_311.dll';

I renamed the dll as follow

FB3.0.11 32/64bit -> fbclient32_311.dll / fbclient64_311.dll

FB4.0.4 32/64bit -> fbclient32_404.dll / fbclient64_404.dll

FB5.0.0 32/64bit -> fbclient32_500.dll / fbclient64_500.dll

Share this post


Link to post

In the meantime, I have come up with a solution. I have debugged something in the library. I found out that if the protocol is set to "ipLocal", the port is not taken into account. You have to change the protocol to "ipTCPIP" and set the host to "localhost", then it works.

 

Follow the final code

  FUNCTION TfrmMain.GetFirebirdServerInfo: boolean;
  VAR
    FDIBInfo: TFDIBInfo;
    AVersion: TIBInfo.TVersion;
    AConfig: TIBInfo.TConfig;
  BEGIN
    Result := False;
    IF (teFirebirdInstallPath.Text = '') AND (teFirebirdVersion.Text = '') THEN BEGIN
      FDIBInfo := TFDIBInfo.Create(Self);
      TRY
        FDPhysFBDriverLink.VendorLib := teVendorLibrary.Text;
        FDIBInfo.Protocol := ipTCPIP;
        FDIBInfo.DriverLink := FDPhysFBDriverLink;
        FDIBInfo.Host := 'localhost';
        FDIBInfo.Port := spePort.Value;

        FDIBInfo.UserName := teUsername.Text;
        FDIBInfo.Password := tePassword.Text;
        FDIBInfo.GetVersion(AVersion);
        teFirebirdVersion.Text := AVersion.FServerStr;

        FDIBInfo.UserName := teUsername.Text;
        FDIBInfo.Password := tePassword.Text;
        FDIBInfo.GetConfig(AConfig);
        teFirebirdInstallPath.Text := AConfig.FServerPath;

        Result := True;
      FINALLY
        FDIBInfo.Free;
      END;
    END ELSE BEGIN
      Result := True;
    END;
  END;

 

  • Like 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×