* * *

Author Topic: (Resolved) Firebird 3.0 connection problem.  (Read 1379 times)

iru

  • Full Member
  • ***
  • Posts: 207
(Resolved) Firebird 3.0 connection problem.
« on: November 05, 2018, 04:24:10 am »
Gentlefolk,
I am having trouble connecting to a remote FB 3.0 server from Lazars/Pascal.

Environment:
  Client: Linux Mint 19, 64 bit. Link in /usr/lib ln -s /usr/lib/x86_64-linux-gnu/libfbclient.so.3.0.2 libfbclient.so.2.5.1
      Firebird: 3.0.2
      Laz/Pascal: 1.84, 3.04
  Host: Linux Mint 19, 64 bit. Can use isql-fb to access FB and database.
     Firebird: 3.0.2
     Database is in /home/iru/FDB/TrackFb.fdb, User iru (me) and firebird have read/write access to FDB and TrackFb.fdb.

The problem:
  I have some code which programatically sets up the FB connelction (TIBConnection), this gave errors

  For simplicity I created a new project, singe form with a TIBConnection.
  Filled in all parameters on the IBConnection using the object inspector.
  Clicked on "Connected" and I get an error "No such file or directory". The directory and file exist on the remote system.
  If I disconnect the remote system from the network I get a failure to connect error - correct.
  Placed a button on the form, the 'click' event simply sets the IBConnection true.

  An error occurs at IBConnection 625:
      FSQLDatabaseHandle := nil;
      if HostName <> '' then ADatabaseName := HostName+':'+DatabaseName
         else ADatabaseName := DatabaseName;
      if isc_attach_database(@FStatus[0], Length(ADatabaseName), @ADatabaseName[1],
        @FSQLDatabaseHandle,
           Length(DPB), @DPB[1]) <> 0 then
    CheckError('DoInternalConnect', FStatus);

  ADatabaseName contains the correct path and file name /home/iru/FDB/TrackFb.fdb.
  Parameter on the IBConnection are:
    Database name: /home/iru/FDB/TrackFb.fdb
    Dialect 3
    Hostname 192.168.1.99 - correct, can ping and telnet to port 3050. 
    Login prompt false
    Options default
    Params nil
    Password valid password
    Username valid name.

I am stuck, cant get down below isc_attach_database......

Any ideas, suggestions, whatever appreciated Ian
« Last Edit: November 05, 2018, 11:26:14 pm by iru »

valdir.marcos

  • Hero Member
  • *****
  • Posts: 526
Re: Firebird 3.0 connection problem.
« Reply #1 on: November 05, 2018, 07:57:09 am »
I am having trouble connecting to a remote FB 3.0 server from Lazars/Pascal.

Environment:
  Client: Linux Mint 19, 64 bit. Link in /usr/lib ln -s /usr/lib/x86_64-linux-gnu/libfbclient.so.3.0.2 libfbclient.so.2.5.1
      Firebird: 3.0.2
      Laz/Pascal: 1.84, 3.04
  Host: Linux Mint 19, 64 bit. Can use isql-fb to access FB and database.
     Firebird: 3.0.2
     Database is in /home/iru/FDB/TrackFb.fdb, User iru (me) and firebird have read/write access to FDB and TrackFb.fdb.
Can you use any administrative tool, such as FlameRobin, to connect to you Firebird database from Client machine to Server machine?
If not, what error messages do you get?

valdir.marcos

  • Hero Member
  • *****
  • Posts: 526
Re: Firebird 3.0 connection problem.
« Reply #2 on: November 05, 2018, 08:02:53 am »
I am having trouble connecting to a remote FB 3.0 server from Lazars/Pascal.
...
The problem:
  I have some code which programatically sets up the FB connelction (TIBConnection), this gave errors
Please, show that part of your code.

iru

  • Full Member
  • ***
  • Posts: 207
Re: Firebird 3.0 connection problem.
« Reply #3 on: November 05, 2018, 10:17:46 am »
Thank you for the response/s.

I can FlameRobin from the client to the remote host Firebird, create database, tables, etc.

My code picks up parameters from a .INI and is rather to messy to put up here.
My second project with just a IBConnection and setting the "Connected" property at design time produces the same result.

I have done some more work:

Installed the 'wireshark' protocol analyser and can see a complete TCP sequence between the client and host, so we talk to the remote firebird.

Checked the code in IBConnection at line 165, The problem is in the code (and the value of 'Status'

  Definition: (Status               : array [0..19] of ISC_STATUS)
  Value:  Status = pisc_status($00007FFFF7FBB0F8) = 1

  if ((Status[0] = 1) and (Status[1] <> 0)) then
  begin
    ErrorCode := Status[1];
{$IFDEF LinkDynamically}
    if assigned(fb_sqlstate) then // >= Firebird 2.5
    begin
      fb_sqlstate(Buf, Status);
      SQLState := StrPas(Buf);
 
So it looks like Firebird gets something it doesnot like and returns an ugly status.

I will have a look at the firebird configuration file.

Ian

iru

  • Full Member
  • ***
  • Posts: 207
Re: Firebird 3.0 connection problem.
« Reply #4 on: November 05, 2018, 11:42:44 am »
Gentlefolk,

Worked my way through firebird.conf.

Changed AuthServer = Srp to AuthServer = Legacy_Auth.

Restarted firebird.
Set 'Connected' on the IBConnection (via the Object inspector).
The connection failed with a different error. Complaining about 'User name and password not defined'.

Significantly FlameRobin (which has accessed the remote  database correctly) now fails with the same error!!!!!

So it looks like I have a problem with Firebird 3.0 and LAZ 1.84.....

Ian

Zoran

  • Hero Member
  • *****
  • Posts: 1279
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: Firebird 3.0 connection problem.
« Reply #5 on: November 05, 2018, 01:25:08 pm »
Gentlefolk,

Worked my way through firebird.conf.

Changed AuthServer = Srp to AuthServer = Legacy_Auth.

Restarted firebird.
Set 'Connected' on the IBConnection (via the Object inspector).
The connection failed with a different error. Complaining about 'User name and password not defined'.

Significantly FlameRobin (which has accessed the remote  database correctly) now fails with the same error!!!!!

So it looks like I have a problem with Firebird 3.0 and LAZ 1.84.....

Ian

To me it looks like the problem between fbclient and FB server. You should not change that parameter to Legacy_Auth, unless you use older fbclient.
Change that parameter back to Srp, restart fb server, then on client machine make sure that you have the client installed is not from older version.

Now, make absolutely sure that the all sym links you mentioned in your first post point to this new library (even those named libfbclient.so.2..)
Flame Robin, if installed from repo, can make this problem - it silently installs the fbclient from 2.5.x and makes incorrect symlinks. That may  have happend on your client.

iru

  • Full Member
  • ***
  • Posts: 207
Re: Firebird 3.0 connection problem.
« Reply #6 on: November 05, 2018, 11:45:44 pm »
Gentlefolk,

Downloaded fbclient3.0.4.
Set up new link from fbclient.2.5.1 to point to fbclient3.0.4.
Set /etc/firebird/3.0/firebird.conf: AuthServer = Srp and UserManager = Srp.
Studied isql-fb database connection syntax.
Checked everything for case, spelling, permissions, etc.
Restarted everything......

It works??? In the small test project when I set the FBConnection.Connect property = TRUE NO errors (database not found, user name/password not found) are reported.

isql-fb (with correct syntax) works.

However if I compile the small test project the compiler complains about "Cannot find default Firebird clients (libfbclient.2.5.1.......).

I battle on. Thanks for the support. ian
Things are looking up.

iru

  • Full Member
  • ***
  • Posts: 207
Re: (Resolved) Firebird 3.0 connection problem.
« Reply #7 on: November 05, 2018, 11:53:30 pm »
Woops, it is not the compiler complaining about not finding the libfbclient.so.2.5.1.

It is the debugger.... Ian.

iru

  • Full Member
  • ***
  • Posts: 207
Re: (Resolved) Firebird 3.0 connection problem.
« Reply #8 on: November 06, 2018, 02:39:28 am »
Last issue solved by:

/usr/lib$ sudo ln /usr/lib/x86_64-linux-gnu/libfbclient.so.2 /usr/lib/x86_64-linux-gnu/libfbclient.so

Ian

 

Recent

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