c# - 在 64 位 Linux 环境中使用嵌入式 firebird 获取 Mono

标签 c# linux mono firebird firebird-embedded

我正在尝试在 Linux 上使用 firebird .net 提供程序 (FirebirdSql.Data.FirebirdClient) 运行 Firebird 嵌入式 2.5(64 位)。

我的测试程序集的 FB 嵌入式设置在带有 Windows Firebird 嵌入式版本的 WinX86_64 上运行。 在Linux上我使用对应的FB embedded Linux版本在汇编目录下放置文件:

  • libfbembed.so*
  • Firebird .msg
  • security2.fdb
  • 立比库*
  • 库*

在 firebird.conf 中将“RootDirectory”设置为程序集目录。 将 shell 环境变量 LD_LIBRARY_PATH 和 FIREBIRD 设置为程序集目录。

        FbConnectionStringBuilder conn = new FbConnectionStringBuilder();            
        conn.Database = @"/home/dev/firebirdTest/1stDB.FDB";
        conn.ServerType = FbServerType.Embedded;
        conn.UserID = "SYSDBA";
        conn.Password = "masterkey"; 
        conn.Charset = "UTF8";
        conn.DataSource = "localhost";
        conn.ClientLibrary = "libfbembed.so";
        string connStr = conn.ConnectionString;
        var dbcon = new FbConnection(connStr);
        FbConnection.CreateDatabase(connStr, pageSize: 8192, forcedWrites: true, overwrite: false);
        dbcon = new FbConnection(connStr);
        dbcon.Open();

我之前做了什么:

  • 通过 mono dllmap 重定向 Firebird Clientlibrary 无效。通过在 C# 代码中显式设置 ClientLib 解决。
  • 在 Linux 上使用 isql 手动创建数据库是可行的。
  • 在 Linux 上通过代码创建数据库是可行的。
  • Firebird .NET 提供程序在 Debug模式下创建 FB_{sanitizedName}.dll 和 DynamicAssembly.dll
  • .NET 提供商真的很安静。通过在 Linux 上使用“strace mono {testAssembly.exe}”启动程序集来完成调试。
  • 如果页面大小不是 8192,FbConnection.CreateDatabase 在“打开 O_CREAT”(调用 FbCreateDatabase)期间因 I/O 错误而崩溃。将页面大小显式设置为 8192 可解决此问题。

现在,我遇到了以下错误(并在这里停留了好几天...):

  • 打开一个现有的数据库文件(就像这里的代码),崩溃:

    FirebirdSql.Data.FirebirdClient.FbException: 无效的数据库句柄(无事件连接)---> 无效的数据库句柄(无事件连接)

出了什么问题?

最佳答案

我也遇到过这个错误。 FirebirdSql.Data.FirebirdClient.FbException:无效的数据库句柄(无事件连接) 尝试使用 FB 2.5.* 和 3.0.0 结果相同。 还尝试使用 FB 的调试版本。日志没有帮助。

也许这里有人知道问题出在哪里?

关于c# - 在 64 位 Linux 环境中使用嵌入式 firebird 获取 Mono,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37140117/

相关文章:

c# - Swagger 的错误。服务器在处理请求时遇到错误

linux - Busybox 环境不显示 LD_LIBRARY_PATH

c# - Linux 上单声道中的 WLAN 信息

c# - 使用 Action<PointerClass*> 作为参数

c# - 使用 OpenCV 打开和关闭

c# - 将枚举存储到数据库的平滑方法

linux - Linux服务器中的PGP

php - 在特定日期运行脚本?

MonoTouch 与可移植库项目无法构建

C# SSL/TLS HTTPS 和合法/可信证书错误