2012-01-29 93 views
0

我下載了Firebird-1.5.6.5026-0_embed_win32.zip並將文件fbembed.dll和firebird.msg和ib_util.dll複製到我的程序附近。 和我使用此連接字符串:使用嵌入式火鳥

<add name="Connection" connectionString="server type=Embedded;user=SYSDBA;password=masterkey;database=E:\TEST.FDB;dialect=3;charset=NONE;connection lifetime=15;pooling=true;minpoolsize=0;maxpoolsize=50;packet size=8192;servertype=0;clientlibrary=fbembed.dll" providerName="FirebirdSql.Data.FirebirdClient" /> 

,但是當我跑我的項目,我得到了錯誤。

+0

你得到什麼錯誤? – 2012-01-29 16:19:26

+0

無法訪問主機上的數據庫服務器錯誤詳細信息:無法完成主機「localhost」的網絡請求 – 2012-01-29 16:25:11

+0

爲什麼使用Firebird 1.5?火鳥2.5.1是最新的版本 – 2012-01-30 09:18:12

回答

0

你需要添加firebird.msg,firebird.conf,icudt30.dll,icuin30.dll,icuuc30.dll和ib_util.dll到您的項目文件和輸出文件夾..

重要通知:從不使用緊湊的.Net數據提供程序。因爲他們只爲普通和超級火鳥服務器。它不適用於嵌入式服務器。

嘗試一下:

FbConnection con = new FbConnection("User=SYSDBA;" + "Password=masterkey;" + "Database=TEST.FDB;" + "DataSource=127.0.0.1;" + "Port=3050;" + "Dialect=3;" + "Charset=UTF8;"); 
try { 
     con.Open(); 
    } 
catch (Exception ex) 
    { 
     MessageBox.Show(ex.ToString()); 
    } 

這裏是我原來的答案,原來的問題: How to connect and use Firebird db embedded server with Visual C# 2010

0

它看起來像你的連接字符串是錯誤的。我無法驗證是肯定的,但根據this CodeProject project使用嵌入式它應該更像是Firebird數據庫:

"ServerType=1;User=SYSDBA;Password=masterkey;Dialect=3;Database=mydb.fdb" 

通知的服務器類型參數。