Connecting to FireBird Embedded Database from C # Problem

It seems I have a problem connecting to the embedded FireBird database from a C # sample application. Here is what I have.

static void Main(string[] args)
    {

        //Some constant parameters used to form up the connection string... 
        #region constant literals
        const String User = "SYSDBA";
        const String Password = "masterkey";
        const String DBPath = "D:\\!tmp\\1\\cafw.fdb";
        const String DLLPath = @"fbembed.dll";
        const String Charset = "WIN1251";
        const int Dialect = 3;
        #endregion

        //I check whether we actually have a database file nearby
        //and fbembed.dll. If we don't - we leave
        if (File.Exists(DBPath) == true && File.Exists(DLLPath) == true)
        {
            //I form up a connection string out of literals I've declared above
            FbConnectionStringBuilder CStr = new FbConnectionStringBuilder();

            CStr.ServerType = FbServerType.Embedded;                
            CStr.UserID = User;
            CStr.Password = Password;                
            CStr.Dialect = Dialect;                
            CStr.Database = DBPath;
            CStr.Charset = Charset;                                
            CStr.ClientLibrary = DLLPath;

            //And then I finally try to connect
            FbConnection Conn = new FbConnection(CStr.ToString());                

            try
            {
                //See what we've got in the end
                Console.WriteLine(CStr.ToString());
                //And try to connect
                Conn.Open();
            }
            catch (Exception Ex)
            {
                //Show me what has gone wrong
                Console.WriteLine("\n" + Ex.Message.ToString());
                Console.ReadKey();
            }
            finally
            {
                Conn.Close();
            }
        }
    }

The problem is that it gives me

server type = Embedded; user id = SYSDBA; password = masterkey; dialect = 3; initial directory = D :! tmp \ 1 \ cafw.fdb; character set = WIN1251; client library = fbembed.dll

There are no messages for error code 335544972.

Invalid ESCAPE Sequence

as a conclusion.

I figured out to find out about error code 335544972, and this seems like an invalid connection string, but I did not find any "official" information about it.

If anyone comes across something similar so that you can tell me what I'm doing wrong?

Thank.

UPD: , . , , ,

FbConnection Conn = new FbConnection("Database=D:\\tmp\\1\\cafw.fdb;ServerType=1");

, "Trusted Auth Embedded Firebird". , sysdba login

FbConnection Conn = new FbConnection("Database=D:\\tmp\\1\\cafw.fdb;ServerType=1;User=SYSDBA;Password=masterkey");

.

+3
2

.

, , , , # - d:......\#\myAppProject (, #).

, , .

+5

, , , ..

, , ( ).

+1

Source: https://habr.com/ru/post/1741601/


All Articles