Connecting to embedded FireBird database from C# app issue
Posted
by be here now
on Stack Overflow
See other posts from Stack Overflow
or by be here now
Published on 2010-04-17T20:02:16Z
Indexed on
2010/04/17
20:13 UTC
Read the original article
Hit count: 423
Hi, guys.
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.
© Stack Overflow or respective owner