Firebird .NET提供程序和嵌入式服务器3

Bar*_*rzo 6 c# firebird firebird-embedded firebird-3.0 firebird-.net-provider

我正在尝试使用.NET Firebird Provider连接到嵌入式FB 3.0.1服务器.

据我所知,(也写在这里(第6页)),没有更多的fbclient.dll\fbembed.dll,但单个客户端fbclient.dll用于远程和嵌入式访问.

但是当我调用FBConnection.Open()时,我得到一个System.DllNotFoundException:

Unable to load DLL 'fbembed': 
Impossible to find the specified module (Exception from HRESULT: 0x8007007E).
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?

Bar*_*rzo 6

在提供者代码中查找默认客户端库(可能出于兼容性考虑):

internal const string DefaultValueClientLibrary = "fbembed";
Run Code Online (Sandbox Code Playgroud)

现在,将新值传递给ConnectionString可以解决问题:

  var connectionString = new FbConnectionStringBuilder
  {
    Database = dbPath,
    ServerType = FbServerType.Embedded,
    UserID = "SYSDBA",
    Password = "masterkey",
    ClientLibrary = "fbclient.dll"
  }.ToString();
Run Code Online (Sandbox Code Playgroud)

  • @vitalygolub您的评论有何贡献?如果OP希望在C#中使用Firebird Embedded,那么这是唯一的方法。 (2认同)