Search code examples
delphidelphi-xe5firedac

How I can configure firedac to relative path to database firebird in DesignTime


How I can configure firedac to relative path to database firebird in DesignTime

object Conn: TFDConnection
Params.Strings = (

    'Database=..\..\Win32\' +
    'bin\DADOS.FDB'
  'Protocol=TCPIP'
  'Server=127.0.0.1'
  'User_Name=sysdba'
  'Password=masterkey'
  'CharacterSet=win1252'
  'ExtendedMetadata=True'
  'DriverID=FB')
ResourceOptions.AssignedValues = [rvAutoConnect, rvAutoReconnect]
ResourceOptions.AutoConnect = False
ResourceOptions.AutoReconnect = True
ConnectedStoredUsage = [auDesignTime]
LoginPrompt = False
Left = 56
Top = 24
end

object FDPhysFBDriverLink1: TFDPhysFBDriverLink
  DriverID = 'FB'
  VendorLib = '..\$(Platform)\bin\fbclient.dll'
  Left = 136
  Top = 24
end

DriverLink Works, Firedac connection no.

Only this works

object Conn: TFDConnection
Params.Strings = (

    'Database=D:\Users\Paulo\Documents\Projetos\ProjectName\Win' +
    '32\bin\DADOS.FDB'
  'Protocol=TCPIP'
  'Server=127.0.0.1'
  'User_Name=sysdba'
  'Password=masterkey'
  'CharacterSet=win1252'
  'ExtendedMetadata=True'
  'DriverID=FB')

This utils in case use subversion control, don't neds configure path to DesignTime.


Solution

  • I'm not sure if it's possible. Even if it were, it doesn't sound like a reliable solution. FireDAC would need to have some explicit option to define a working directory for its design time part. Otherwise it would be tied to the IDE's working directory.

    Instead I would make a connection definition which would be stored on each member's computer and use this definition for the connection component. This will work even if you'll be versioning that DB because everyone can set the path to their subversion folder to that database individually.

    Except that it brings the benefit of separating from this versioned database (if someone decides to use their own database stored somewhere else, they just modify their connection definition file). It's like an ordinary database alias, just more complex.