3

I'm connecting my Firebird database with FireDAC (migrating from FIBPlus and using XE8 update 1). I'm using trusted authentication (OSAutenth=True). I need to read the list of tables within the database. I'm using the TFDConnection.GetTableNames and it works well with standard autenthication (username+password) but I'm not capable to get it work using trusted authentication. Maybe I'm doing something wrong or I'm using the wrong method to to get that kind of info. This is what I'm doing:

var
  oDef : IFDStanConnectionDef;
  oPars: TFDPhysFBConnectionDefParams;
begin
  oDef:=FDManager.ConnectionDefs.AddConnectionDef;
  oDef.Name:='MyFirebird';

  oPars:=TFDPhysFBConnectionDefParams(oDef.Params);
  oPars.DriverID:='FB';
  oPars.Protocol:=ipTCPIP;
  oPars.Server:=edServer.Text;
  oPars.SQLDialect:=3;
  oPars.Database:=edDataBase.Text;
  oPars.OSAuthent:=(edPassword.Text='');
  oPars.UserName:='SYSDBA';
  oPars.Password:=edPassword.Text;
  oPars.RoleName:=edRole.Text;
  oPars.OpenMode:=omOpen;

  FDPhysFBDriverLink1.Embedded:=False;
  FDPhysFBDriverLink1.VendorLib:='c:\MyProgram\fbclient.dll';

  FDConnection1.ConnectionDefName:='MyFirebird';
  FDConnection1.Connected:=TRUE;

  FDConnection1.GetTableNames('','','',Memo1.Lines,[osMy],[tkTable]);       '<--- doesn't works with os authentication

  FDQuery1.SQL.Text:='select * from MYTABLE';
  FDQuery1.Active:=TRUE;                                              '<--- works fine in both kind of authentication

The FIBPlus TpFIBDatabase.GetTableNames that I am going to substitute works fine with both kind of authentications.

Any idea?

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
  • I'm looking in FIBPlus code and it does just a simple query to **RDB$RELATIONS** table to get that kind of data. For now I could solve doing in the same way. –  Jul 08 '15 at 09:58
  • From http://docwiki.embarcadero.com/RADStudio/XE8/en/Connect_to_InterBase_%28FireDAC%29, `OsAutent` is working only for '`DriverID=IB`, and should be `oPars.Add('OSAuthent=Yes');`. – Val Marinov Jul 08 '15 at 11:54
  • @ValMarinov I'm using Firebird not IB. From (http://docwiki.embarcadero.com/RADStudio/XE8/en/Connect_to_Firebird_(FireDAC)) OsAuthent is available and it seems working (I'm using it to read write data to the connection). TFDConnection.GetTableNames is not working properly. –  Jul 08 '15 at 12:32

1 Answers1

0

Change your command as follows:

FDConnection1.GetTableNames('','','',Memo1.Lines,[osMy],[tkTable],true);
A.K
  • 106
  • 1
  • 11