问题
Running on Windows 7 using Visual Studio 2005, I am attempting to use the embedded firebird server. Having followed installation details provided, I get the message:-
Specified server type is not correct.
I am using:-
FirebirdSql.Data.FirebirdClient.dll version 2.5.2.0.
fbembed.dll version 2.5.0.26074
I copied the entire contents of the zip file Firebird-2.5.0.26074-0_Win32_embed.zip to my application directory, as there seem to be a variety of ideas as to what should be there.
I also copied fbembed.dll and renamed it to gds32.dll and fbclient.dll as has been suggested elsewhere.
My connection string is:-
User=SYSDBA;Password=masterkey;database=C:\Database\EMPLOYEE.FDB;servertype=1; Dialect=3;";
All users have full control on the database file.
I have a firebird server running on the same machine, I ensured the service was stopped to avoid any confusion.
The stack trace at the failure shows:-
at FirebirdSql.Data.FirebirdClient.ClientFactory.CreateDatabase(FbConnectionString options) at FirebirdSql.Data.FirebirdClient.FbConnectionInternal.Connect() at FirebirdSql.Data.FirebirdClient.FbConnectionPool.Create() at FirebirdSql.Data.FirebirdClient.FbConnectionPool.CheckOut() at FirebirdSql.Data.FirebirdClient.FbConnection.Open()
Appreciate any ideas.
回答1:
The very latest stuff (8/2015) doesn't seem to like ServerType=1 in the connect string but rather using the stringbuilder:
FbConnectionStringBuilder cs = new FbConnectionStringBuilder();
cs.UserID = "SYSDBA";
cs.Password = "masterkey";
cs.Database = Form1.DataBaseFullPath;
cs.Charset = "UTF8";
cs.Pooling = false;
cs.Dialect = 3;
cs.ServerType = FbServerType.Embedded;
FbConnection Connection = new FbConnection(cs.ToString());
If you look at the result you will see the syntax is "...;server type=embedded". Space between "server" and "type".
回答2:
Try adding the DataSource in the ConnectionString, e.g.
Data Source=localhost;
[Edit]
Also, have a look at this SO question. It mentions a couple of DLLs that were additionally needed to run Firebird as embedded.
回答3:
Whatever the problem was, it has been resolved by using the latest version (2.7.5) of the Firebird dot net provider (thanks to Jiri on the firebird mailing lists).
来源:https://stackoverflow.com/questions/9908918/trying-to-use-the-firebird-embedded-server-specified-server-type-is-not-correc