将免费 DBX 驱动程序与 TSQLConnection 结合使用时出现的问题

发布于 2024-11-28 17:10:50 字数 1323 浏览 1 评论 0原文

我从此处下载了免费的 DBX 驱动程序。我已经尝试让它工作两天了,但没有成功。

这是我的代码的快照:

unit uMainForm;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, SqlExpr, WideStrings, DBXDynalink, DB;

type
  TMainForm = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  MainForm: TMainForm;

implementation

{$R *.dfm}

procedure TMainForm.Button1Click(Sender: TObject);
var C: TSQLConnection;
begin
  C := TSQLConnection.Create(Self);
  try
    C.DriverName := 'FirebirdConnection';
    C.LibraryName := 'dbxfb4d12.dll';
    C.VendorLib := 'fbclient.dll';
    C.GetDriverFunc := 'getSQLDriverFIREBIRD';
    C.Params.Add('User_Name=SYSDBA');
    C.Params.Add('Password=masterkey');
    C.Params.Add('Database=C:\MyDB.fdb');
    C.Open;
    if C.Connected then
      ShowMessage('Connection is active')
  finally
    C.Free;
  end;
end;

运行测试后我收到错误:

无法加载 fbclient.dll(错误代码 22)。它可能会从 系统路径。

我的应用程序路径中有所需的库,甚至在 System32 路径中也有它们。我没有使用 dbxdrivers.ini 和 dbxconnections.ini。

那么这是怎么回事呢?我有带有最新更新的 Delphi 2009。

I've downloaded free DBX driver from here. I have been trying to make it work for two days now, without success.

Here is the snapshot of my code:

unit uMainForm;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, SqlExpr, WideStrings, DBXDynalink, DB;

type
  TMainForm = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  MainForm: TMainForm;

implementation

{$R *.dfm}

procedure TMainForm.Button1Click(Sender: TObject);
var C: TSQLConnection;
begin
  C := TSQLConnection.Create(Self);
  try
    C.DriverName := 'FirebirdConnection';
    C.LibraryName := 'dbxfb4d12.dll';
    C.VendorLib := 'fbclient.dll';
    C.GetDriverFunc := 'getSQLDriverFIREBIRD';
    C.Params.Add('User_Name=SYSDBA');
    C.Params.Add('Password=masterkey');
    C.Params.Add('Database=C:\MyDB.fdb');
    C.Open;
    if C.Connected then
      ShowMessage('Connection is active')
  finally
    C.Free;
  end;
end;

After running the test I am receiving error:

Unable to load fbclient.dll(ErrorCode 22). It may be missing from the
system path.

I have required libraries in my application path, I have them even in the System32 path. I am not using dbxdrivers.ini and dbxconnections.ini.

So what is going on here? I have Delphi 2009 with latest updates.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

隔纱相望 2024-12-05 17:10:50

您是否还尝试将 fbclient.dll 文件与可执行文件放在同一文件夹中?

Did you also try to put the fbclient.dll file in the same folder as the executable?

那小子欠揍 2024-12-05 17:10:50

有时需要将 fbclient.dll 重命名为 gds32.dll。它可能会起作用。

Sometimes it's necessary to have the fbclient.dll renamed to gds32.dll. It might do the trick.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文