FirebirdSql Error occurred during login, please check server firebird.log for details

痴心易碎 提交于 2021-01-29 18:34:52

问题


I am trying to connect and read data from Firebird database using the FirebirdSQL .net provider (using FirebirdSql.Data.FirebirdClient). Here is the code:

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

While trying to Open() the connection, i get an error:

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

Here is the exception detail:

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: 

Please help.


回答1:


I have solved this issue with the help of comments above. Steps were taken to resolve:

  1. Updated WireCrypt = Enabled in Firebird.conf file
  2. Grant read&write permissions to all application packages to the Firebird installation folder (C:\Program Files\Firebird\Firebird_3_0)
  3. I had my database at C:\FirebirdDb folder, I deleted this DB and created a new DB at the default location (i.e. the Firebird installation folder).

And here is my code:

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));
                }
            }
        }
    }
}



回答2:


If you need to run the Firebird server in application mode, run it as administrator.

This solved the problem for me. The Firebird server needs write access to some files in the installation folder.



来源:https://stackoverflow.com/questions/56946309/firebirdsql-error-occurred-during-login-please-check-server-firebird-log-for-de

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!