* * *

Author Topic: IBServerProperties.FetchVersionInfo is fetching only the local machine's info  (Read 646 times)

RedOctober

  • Full Member
  • ***
  • Posts: 209
Platform: Windows Server Essentials 2016, Lazarus 1.8.1, FPC 3.0.5,  IBX 2.1.0

IBServerProperties.FetchVersionInfo is grabbing the version info of the locally installed Firebird server only, and not the version info of a remote server.  I have tested this on several different machines and it's behavior is consistent.  So either there is a bug, or I need to set something that I'm not aware of.

In the following code, the FetchVersionInfo grabs the local Firebird server info (v3x) as if the ServerName was set to:   'localhost/3050'
It should be fetching the version info from the remote Firebird server info (v2x).

Code: Pascal  [Select]
  1.   str_lst: TStringList;
  2. ...
  3.   fb_sp := nil;
  4.   str_lst := nil;
  5.   try
  6.     str_lst := TStringList.Create;
  7.     fb_sp := TIBServerProperties.Create(Self);
  8.     fb_sp.ServerName := 'SRV1/3050';
  9.     fb_sp.Active := True;
  10.     fb_sp.FetchVersionInfo;
  11.     str_lst.Add('Server Name: ' + fb_sp.ServerName);
  12.     str_lst.Add('Server Version: ' + fb_sp.VersionInfo.ServerVersion);
  13.     str_lst.Add('Server Implementation: ' + fb_sp.VersionInfo.ServerImplementation);
  14.     str_lst.Add('Service Version: ' + IntToStr(fb_sp.VersionInfo.ServiceVersion));
  15.   finally
  16.     ShowMessage(str_lst.Text);  // <--- Should display info for FB 2x, but it's not.
  17.     fb_sp.Free;
  18.   end;          
  19.  


dsiders

  • Jr. Member
  • **
  • Posts: 50
Platform: Windows Server Essentials 2016, Lazarus 1.8.1, FPC 3.0.5,  IBX 2.1.0

IBServerProperties.FetchVersionInfo is grabbing the version info of the locally installed Firebird server only, and not the version info of a remote server.  I have tested this on several different machines and it's behavior is consistent.  So either there is a bug, or I need to set something that I'm not aware of.

In the following code, the FetchVersionInfo grabs the local Firebird server info (v3x) as if the ServerName was set to:   'localhost/3050'
It should be fetching the version info from the remote Firebird server info (v2x).

Code: Pascal  [Select]
  1.     fb_sp := TIBServerProperties.Create(Self);
  2.     fb_sp.ServerName := 'SRV1/3050';
  3.  

Consistent is good... even when it's consistently not working. And might be because the host name cannot be resolved, and it's falling back to the localhost loopback.

I am assuming that the Protocol property in server properties is set to TCP. In that case the server name "SRV1" has to be resolvable using either DNS or the host file on the local computer. If it's not resolving to an IP address using a command line ping, you'll want to use the IP address instead of a symbolic name. IOW, ServerName := '10.10.1.62/3050'.

Or modify each of the host files to map SRV1 to an IP address.
Lazarus 1.8.2 / FPC 3.0.4 / Windows 8.1 64-bit

RedOctober

  • Full Member
  • ***
  • Posts: 209
Hi dsiders, here is some additional info:

>>I am assuming that the Protocol property in server properties is set to TCP.

Yes it is.

>>In that case the server name "SRV1" has to be resolvable using either DNS or the host file on the local computer. If it's not resolving to an IP address using a command line ping, you'll want to use the IP address instead of a symbolic name. IOW, ServerName := '10.10.1.62/3050'.

Yes, tried that to ensure both SRV1 and the IP address are ping-able and working.  They are.  I can run the IBRestore service with these same settings and it works.  This is why I'm suspecting that it's a bug in the IBServerProperties. Fetch code.

Still unresolved.


tonyw

  • Full Member
  • ***
  • Posts: 117
    • MWA Software
Platform: Windows Server Essentials 2016, Lazarus 1.8.1, FPC 3.0.5,  IBX 2.1.0

IBServerProperties.FetchVersionInfo is grabbing the version info of the locally installed Firebird server only, and not the version info of a remote server.  I have tested this on several different machines and it's behavior is consistent.  So either there is a bug, or I need to set something that I'm not aware of.

If there is a problem then it is not with "FetchVersionInfo" it will be with establishing the connection to the Services API in the first place. The "FetchVersionInfo" command talks to whichever server it is connected to and gets its version information. It is also not particularly informative when it comes to telling you which server you are connected to as the information is limited to version information rather than specific version info. If you really want to be sure as to which server you are talking to then use the TIBLogService as the log identifies the server.

Points to look at:

1. When executing "Active := true", a connection is made to the server and you should have had to enter a username and password. Are you using the same password for the remote server and your local server? If not then which one did you enter as that will give a very good indication of which you are connected to.

2. Try running the example services application in ibx/examples/services. By default this will try and connect to the local server and will initially show you its version info. Click on the "log" button and you will get the server log including the DNS name of the (Local) server.

3. Now select the IBServerProperties component on the example's main form and change its servername property to the same of your remote server "SRV1". Don't bother with the port number as 3050 is the default. Now compile and run the application again. You should now be logged into your remote server and see both its version information and its server log. This works for me.


RedOctober

  • Full Member
  • ***
  • Posts: 209
Thanks for the explanation tonyw.  I now have my .FetchVersionInfo working. 

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus