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

时间:2017-02-01 13:17:32

标签: c# firebird firebird-embedded firebird-3.0

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

据我所知,(也写成here (page 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).

有什么想法吗?

2 个答案:

答案 0 :(得分:4)

查看提供者代码,默认的客户端库是fbembed(可能是为了兼容性):

internal const string DefaultValueClientLibrary = "fbembed";

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

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

答案 1 :(得分:2)

这需要一段时间来弄明白。但我得到了它的工作....

对于嵌入式客户端:
运行NuGet命令:Install-Package FirebirdSql.Data.FirebirdClient

对于嵌入式服务器:
关键点:dll不会作为项目引用添加到Visual Studio中。相反,它们的位置在连接字符串中定义。

here下载完整的服务器zip。然后将这三个文件解压缩到您的项目中。使用类似于下面的结构(或至少确保定义“插件”子目录或FB服务器将引发错误。)
MY_PROJECT \ firebird_server \ fbclient.dll

MY_PROJECT \ firebird_server \ ib_util.dll

MY_PROJECT \ firebird_server \插件\ engine12.dll

然后设置连接字符串:

Database=c:\sample_firebird_database.FDB;
User=my_username;
Password=my_password;
ServerType=1; // 1 = embedded server
Charset=UTF8;
ClientLibrary=c:\my_project\firebird_server\fbclient.dll; 
相关问题