2013-03-21 45 views
0

我使用firebird嵌入式數據庫開發了一個桌面應用程序。 我下載了FirebirdSql.Data.FirebirdClient.dll.I添加此dll以供參考。 我這些文件添加到輸出文件夾如何在使用firebird嵌入式數據庫時解決c#中的連接錯誤?

aliases.conf 
fbembed.dll 
firebird.conf 
firebird.msg 
ib_util.dll 
icudt30.dll 
icuin30.dll 
icuuc30.dll 

而且我用這個連接字符串

String connectionString="ServerType=0;User=SYSDBA;Password=masterkey;Dialect=3;Database=mydb.fdb"; 
FbConnection con = new FbConnection(connectionString); 
       try 
       { 
        con.Open(); 

       } 
       catch (Exception ex) 
       { 
        MessageBox.Show(ex.ToString()); 
       } 

但我得到這個錯誤,我從谷歌搜索,但我無法找到解決方案有誰能幫助我? 注:我看着這個,但它沒有奏效。

http://stackoverflow.com/questions/4014097/how-to-connect-and-use-firebird-db-embedded-server-with-visual-c-sharp-2010?answertab=votes#tab-top 

FirebirdSql.Data.FirebirdClient.FbException (0x80004005): Unable to complete network request to host "localhost". ---> Unable to complete network request to host "localhost". 
    FirebirdSql.Data.FirebirdClient.FbConnectionInternal.Connect() 
    FirebirdSql.Data.FirebirdClient.FbConnectionPool.Create() 
    FirebirdSql.Data.FirebirdClient.FbConnectionPool.CheckOut() 
    FirebirdSql.Data.FirebirdClient.FbConnection.Open() 
+0

它看起來像您的應用程序忽略了嵌入式部分並通過網絡執行標準連接請求。你確定'fbembed.dll'正在通過你的程序加載嗎?某些數據庫訪問層需要將'fbembed.dll'重命名爲前Firebird客戶端('fbclient.dll')才能工作,但我不知道.NET客戶端,所以我不確定這一點。 – jachguate 2013-03-21 00:41:56

+0

感謝您的回覆。我將fbemded.dll重命名爲fbclient.dll,發生了另一個錯誤。 – mikel 2013-03-21 06:36:43

回答

1

連接字符串錯誤。 ServerType應該是1

+0

我得到這個錯誤System.BadImageFormatException:(HRESULT本頁Özel硬粒döndürdü:0x8007000B) FB_965910463_Class.isc_attach_database(IntPtr的[] statusVector,Int16的dbNameLength,字節[] DBNAME,的Int32&數據庫句柄,Int16的parmBufferLength,字節[] parmBuffer) FB_965910463_Class.IFbClient .net_status_database(IntPtr [] statusVector,Int16 dbNameLength,Byte [] dbName,Int32&dbHandle,Int16 parmBufferLength,Byte [] parmBuffer) FirebirdSql.Data.Client.Native.FesDatabase.Attach(DatabaseParameterBuffer dpb,String dataSource,Int32 port,String數據庫) – mikel 2013-03-21 08:03:03

+3

你的應用程序是64位,你有32位'fbembed.dll'(反之亦然)。 – 2013-03-21 09:48:51

+1

我的應用程序是64位,我從http://www.firebirdsql.org/en/net-provider/爲供應商下載NETProvider-3.0.2.0-NET40.7z,我從http://sourceforge.net/下載其他文件projects/firebird/files/firebird-win64/2.5.2-Release/Firebird-2.5.2.26539-0_x64_embed.zip /當我使用這些文件時下載我得到錯誤 – mikel 2013-03-24 06:50:17

相關問題