登录期间发生FirebirdSql错误,请检查服务器firebird.log以获取详细信息

时间:2019-07-09 06:13:45

标签: c# .net firebird firebird-3.0

我正在尝试使用FirebirdSQL .net提供程序(使用FirebirdSql.Data.FirebirdClient)连接并从Firebird数据库读取数据。 这是代码:

FbConnection viewdataConnection=new FbConnection();
viewdataConnection.ConnectionString = "database=localhost:c:\\firebirdTest\\testDB.fdb;user=sysdba;password=firebird";
viewdataConnection.Open();

尝试打开()连接时,出现错误:

An unhandled exception of type 'FirebirdSql.Data.FirebirdClient.FbException' occurred in FirebirdSql.Data.FirebirdClient.dll
Additional information: Error occurred during login, please check server firebird.log for details

以下是异常详细信息:

FirebirdSql.Data.FirebirdClient.FbException was unhandled
  ErrorCode=335545106
  HResult=-2147467259
  Message=Error occurred during login, please check server firebird.log for details
  SQLSTATE=08006
  Source=FirebirdSql.Data.FirebirdClient
  StackTrace:
       at FirebirdSql.Data.FirebirdClient.FbConnectionInternal.Connect()
       at FirebirdSql.Data.FirebirdClient.FbConnectionPoolManager.Pool.CreateNewConnectionIfPossibleImpl(FbConnectionString connectionString)
       at FirebirdSql.Data.FirebirdClient.FbConnectionPoolManager.Pool.GetConnection(FbConnection owner)
       at FirebirdSql.Data.FirebirdClient.FbConnection.Open()
       at UsingFirebird.FormUsers.FormUsersLoad(Object sender, EventArgs e) in C:\Users\vikas\Downloads\UsingFirebird\UsingFirebird\UsingFirebird\FormUsers.cs:line 46
       at System.Windows.Forms.Form.OnLoad(EventArgs e)
       at System.Windows.Forms.Form.OnCreateControl()
       at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
       at System.Windows.Forms.Control.CreateControl()
       at System.Windows.Forms.Control.WmShowWindow(Message& m)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.Form.WmShowWindow(Message& m)
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
  InnerException: 
       ErrorCode=335545106
       HResult=-2146233088
       IsWarning=false
       Message=Error occurred during login, please check server firebird.log for details
       SQLSTATE=08006
       Source=FirebirdSql.Data.FirebirdClient
       StackTrace:
            at FirebirdSql.Data.Client.Managed.GdsConnection.Identify(String database)
            at FirebirdSql.Data.FirebirdClient.ClientFactory.CreateManagedDatabase(FbConnectionString options)
            at FirebirdSql.Data.FirebirdClient.ClientFactory.CreateDatabase(FbConnectionString options)
            at FirebirdSql.Data.FirebirdClient.FbConnectionInternal.Connect()
       InnerException: 

请帮助。

2 个答案:

答案 0 :(得分:0)

我已经通过上面的评论解决了这个问题。 已采取步骤解决:

  1. Updated WireCrypt = Enabled in Firebird.conf file
  2. 将对所有应用程序包的读写权限授予Firebird安装文件夹(C:\Program Files\Firebird\Firebird_3_0
  3. 我的数据库位于C:\FirebirdDb文件夹中,我删除了该数据库并在默认位置(即Firebird安装文件夹)创建了一个新数据库。

这是我的代码:

using (var connection = new FbConnection("database=localhost:test.fdb;user=sysdba;password=masterkey;Charset=NONE;"))
{
    connection.Open();
    using (var transaction = connection.BeginTransaction())
    {
        using (var command = new FbCommand("select * from testTable", connection, transaction))
        {
            using (var reader = command.ExecuteReader())
            {
                while (reader.Read())
                {
                    var values = new object[reader.FieldCount];
                    reader.GetValues(values);
                    Console.WriteLine(string.Join("|", values));
                }
            }
        }
    }
}

答案 1 :(得分:0)

如果您需要在应用程序模式下运行Firebird服务器,请以管理员身份运行它。

这为我解决了问题。 Firebird服务器需要对安装文件夹中的某些文件具有写权限。

相关问题