vb.net 如何解决远程数据库上的 Firebird“数据库不可用”错误?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/38916008/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-17 20:01:09  来源:igfitidea点击:

How to resolve Firebird "unavailable database" error on a remote database?

.netvb.netfirebird

提问by Frosty840

I have a Firebird 2.0 database running on a remote Windows XP PC.
Using the ADO.net connection provider, I configure the connection as follows:

我有一个运行在远程 Windows XP PC 上的 Firebird 2.0 数据库。
使用 ADO.net 连接提供程序,我按如下方式配置连接:

Dim x As New FirebirdSql.Data.FirebirdClient.FbConnectionStringBuilder
x.Database = "[hostname]:FileShare:/db/REMOTE_SVR.FDB"
x.UserID = "SYSDBA"
x.Password = "masterkey"

Dim y As New FirebirdSql.Data.FirebirdClient.FbConnection(x.ConnectionString)
y.Open()

Attempting to open the connection raises an FbException, with the message "unavailable database".

尝试打开连接会引发FbException, 并显示消息“数据库不可用”。

Downloading the ODBC drivers and attempting to connect with those settings produces the same error message.

下载 ODBC 驱动程序并尝试使用这些设置进行连接会产生相同的错误消息。

I have copied the database file to my development environment and verified that I can connect to x.Database = "c:\testdb\REMOTE_SVR.FDB"with these settings (with a local install of Firebird 2.0 Server).

我已将数据库文件复制到我的开发环境中,并验证我可以x.Database = "c:\testdb\REMOTE_SVR.FDB"使用这些设置进行连接(本地安装 Firebird 2.0 Server)。

I have confirmed that the Firebird 2.0 Server is running on the remote PC. The fileshare in which the DB is located doesn't require any login or permissions.

我已经确认 Firebird 2.0 服务器正在远程 PC 上运行。数据库所在的文件共享不需要任何登录或权限。

I'm probably doing something dumb, but I'm out of ideas.

我可能正在做一些愚蠢的事情,但我没有想法。

回答by Mark Rotteveel

Firebird will - by default - not open database files that are located on a network share. The file must be on a physical disk of the server. This is done to protect the database against corruption from incorrect or insufficient locking of the file (eg when accessed by multiple Firebird server processes from different machines).

默认情况下,Firebird 不会打开位于网络共享上的数据库文件。该文件必须位于服务器的物理磁盘上。这样做是为了防止数据库因文件锁定不正确或不充分而损坏(例如,当来自不同机器的多个 Firebird 服务器进程访问时)。

So you need to move the database to one of the real drives of the machine that hosts the Firebird server process.

因此,您需要将数据库移动到承载 Firebird 服务器进程的机器的真实驱动器之一。