使用Firebird 2.5配置FireDac以进行跨平台开发

时间:2016-10-06 13:49:08

标签: macos delphi firebird firedac

我正在使用Delphi 10.1 Berlin和firebird为windows和os x创建一个跨平台数据感知应用程序。我的Mac正在运行El Capitan。我的电脑在Mac上的Parallels虚拟机中运行。

每个平台上的应用程序将连接到位于Win 2008服务器上的firebird 2.5服务器。 win32版本编译和连接没有问题。但是,OS X的那个没有。

我已经在Mac上下载并安装了FB 2.5并正确设置了PAserver。例如,我已经能够使用RazorSQL从我的Mac连接到Windows服务器上的firebird。我还能够通过一个按钮和一个ShowMessage对话框编译一个非常简单的“Hello world”项目,并在Mac上运行它。所以,我确信PAserver正常运行。

我创建了一个用于测试的准系统数据感知应用程序。以下是文本格式的表单:

object Form1: TForm1
  Left = 0
  Top = 0
  Caption = 'Form1'
  ClientHeight = 480
  ClientWidth = 640
  FormFactor.Width = 320
  FormFactor.Height = 480
  FormFactor.Devices = [Desktop]
  DesignerMasterStyle = 0
  object StringGrid1: TStringGrid
    Align = Client
    CanFocus = True
    ClipChildren = True
    Size.Width = 640.000000000000000000
    Size.Height = 440.000000000000000000
    Size.PlatformDefault = False
    TabOrder = 0
    RowCount = 0
    Viewport.Width = 636.000000000000000000
    Viewport.Height = 415.000000000000000000
  end
  object ToolBar1: TToolBar
    Size.Width = 640.000000000000000000
    Size.Height = 40.000000000000000000
    Size.PlatformDefault = False
    TabOrder = 7
    object NavigatorBindSourceDB1: TBindNavigator
      Position.X = 176.000000000000000000
      Position.Y = 7.000000000000000000
      Size.Width = 241.000000000000000000
      Size.Height = 25.000000000000000000
      Size.PlatformDefault = False
      TabOrder = 0
      DataSource = BindSourceDB1
      xRadius = 4.000000000000000000
      yRadius = 4.000000000000000000
    end
  end
  object FDConnection1: TFDConnection
    Params.Strings = (
      'Database=E:\Shared Folders\Employees\Firebird\Databases\Test.fdb'
      'User_Name=SYSDBA'
      'Password= (intentionally deleted)'
      'Protocol=TCPIP'
      'Server=afmsasrv'
      'Port=3024'
      'ExtendedMetadata=True'
      'CharacterSet=win1252'
      'DriverID=FB25')
    Connected = True
    LoginPrompt = False
    Left = 440
    Top = 112
  end
  object FDGUIxWaitCursor1: TFDGUIxWaitCursor
    Provider = 'FMX'
    Left = 344
    Top = 120
  end
  object FDTable1: TFDTable
    Active = True
    IndexFieldNames = 'ID'
    Connection = FDConnection1
    UpdateOptions.UpdateTableName = 'PERSON'
    TableName = 'PERSON'
    Left = 272
    Top = 128
  end
  object DataSource1: TDataSource
    DataSet = FDTable1
    Left = 216
    Top = 128
  end
  object BindSourceDB1: TBindSourceDB
    DataSet = FDTable1
    ScopeMappings = <>
    Left = 304
    Top = 224
  end
  object BindingsList1: TBindingsList
    Methods = <>
    OutputConverters = <>
    Left = 20
    Top = 5
    object LinkGridToDataSourceBindSourceDB1: TLinkGridToDataSource
      Category = 'Quick Bindings'
      DataSource = BindSourceDB1
      GridControl = StringGrid1
      Columns = <>
    end
  end
end

当我运行项目时,我收到以下错误:

[FireDAC][Phys]-300. Driver [FB25] is not registered. Correct driver ID or define [FB25] virtual driver in FDDrivers.ini'. Process Project1 (1114)

我已将FDDrivers.ini添加到我的项目中,如Embarcadero的FireDac文档中所示。这是内容。

[FDDrivers.ini]
Encoding=UTF8

[FB25]
; FB25 virtual driver will use specified Firebird client library
BaseDriverID=FB
VendorLibWin32=C:\firebird\fb25_W32\bin\fbclient.dll
VendorLibWin64=C:\firebird\fb25_64\bin\fbclient.dll
VendorLibOSX32=/Library/Frameworks/Firebird.framework/Libraries/Versions/A/libfbclient.dylib

有关如何使其发挥作用的任何想法?

0 个答案:

没有答案