I seem to have an issue with connecting to an embedded FireBird database from a sample C# app. Here's what I've got.
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, it yields me a
server type=Embedded;user id=SYSDBA;password=masterkey;dialect=3;initial catalog=D:!tmp\1 \cafw.fdb;character set=WIN1251;client library=fbembed.dll
No message for error code 335544972 found.
Invalid ESCAPE sequence
as an output.
I've googled around to find out about 335544972 error code, and it seems to be something about invalid connection string, but I haven't found any "official" info about that.
Hase anybody encountered anything similar so one could tell me what am I doing wrong?
Thanks.
UPD: As it has been adviced, I've tried to simplify my connection string. So, instead of what was done above I used
FbConnection Conn = new FbConnection("Database=D:\\tmp\\1\\cafw.fdb;ServerType=1");
and it gave me a message that "Trusted Auth isn't supported on Embedded Firebird". So, I tried to use a regular sysdba login
FbConnection Conn = new FbConnection("Database=D:\\tmp\\1\\cafw.fdb;ServerType=1;User=SYSDBA;Password=masterkey");
and got the very same error message.
Weird stuff.
It is hard to believe, but the only reason I can name for this is that my c# solution resided somewhere in d:......\c#\myAppProject (yeah, it's all about # sign).
After I replaced the project, all worked correct.