Kir*_*tev 3 c# firebird firebird-.net-provider
我似乎在从示例C#应用程序连接到嵌入式FireBird数据库时遇到问题.这就是我所拥有的.
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();
}
}
}
Run Code Online (Sandbox Code Playgroud)
问题是,它让我产生了一个
server type = Embedded; user id = SYSDBA; password = masterkey; dialect = 3; initial catalog = D:!tmp\1\cafw.fdb; character set = WIN1251; client library = fbembed.dll
找不到错误代码335544972的消息.
ESCAPE序列无效
作为输出.
我已经google了解了大约335544972错误代码,它似乎是关于无效连接字符串的东西,但我没有找到任何关于它的"官方"信息.
任何人遇到类似的事情都可以告诉我,我做错了什么?
谢谢.
UPD:正如我所建议的那样,我试图简化我的连接字符串.所以,而不是我上面所做的
FbConnection Conn = new FbConnection("Database=D:\\tmp\\1\\cafw.fdb;ServerType=1");
Run Code Online (Sandbox Code Playgroud)
它给了我一条消息"嵌入式Firebird不支持Trusted Auth".所以,我尝试使用常规的sysdba登录
FbConnection Conn = new FbConnection("Database=D:\\tmp\\1\\cafw.fdb;ServerType=1;User=SYSDBA;Password=masterkey");
Run Code Online (Sandbox Code Playgroud)
并得到了相同的错误消息.
奇怪的东西.
很难相信,但我可以为此命名的唯一原因是我的c#解决方案存在于d:......\c#\ myAppProject中(是的,它都是关于#符号).
在我更换项目后,一切正常.