尝试在Visual Studio中连接到Firebird时访问拒绝错误 [英] Access Denied error when trying to connect to Firebird in Visual Studio

查看:106
本文介绍了尝试在Visual Studio中连接到Firebird时访问拒绝错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近,我在Visual Studio中将Firebird看作是数据提供者,因此可以正常工作。

I recently have it working that, within Visual Studio, I can see Firebird as a data provider.

我正在从事的项目试图使嵌入式版本的Firebird可以在我的C#程序中使用

The project I am working on I am trying to get the embedded version of Firebird working to use in my c# program

但是,当我转到工具/连接到数据库
选择firebird数据源时,我输入以下内容

However, when I go to Tools/Connect to Database Choose firebird Data source I enter the following

数据源:Firebird数据源(.net Firebird的框架数据提供程序)
数据源:是空白的
数据源端口:3050
的方言:3
charSet:无
数据库:我的fdb文件的路径
服务器类型:嵌入式
用户:用户名我设置
密码:密码我设置
角色:为空

Data source: Firebird Data Source (.net framework data provider for firebird) Data Source: is blank Data Source Port: 3050 Dialect: 3 charSet: NONE Database: path to my fdb file Server Type: Embedded user: username I setup password: password I setup role: is blank

当我单击测试连接,它将立即弹出拒绝访问的提示。

when i click test connection, it immediately pops up that access is denied.

有什么想法可能导致这种情况?

感谢您的帮助。

Any ideas on what might be causing this?
Thanks for the help.

推荐答案

数据库的嵌入式版本以独占模式(DenyRead,DenyWrite)打开数据库文件,服务器版本执行相同的操作。

The Embedded edition of the database open the database file(s) in exclusive mode (DenyRead, DenyWrite), the server edition do the same thing.

这是设计,无法在两个不同的数据库进程之间进行协调,从而无法打开该文件并成功地在其中执行读/写操作并发环境。如果要允许其他进程访问数据库,则必须将其连接到Firebird产品的服务器版本。

That's by design, there's no way of coordination between two different database processes to allow to open that file and perform read/write operations successfully in a concurrent environment. If you want to allow different processes access to the database, you must do it connecting to a server edition of the Firebird product.

开发环境。如果使用嵌入式将IDE连接到数据库,然后也使用嵌入式执行应用程序,则该应用程序将收到拒绝访问错误,因为该文件将由IDE打开。您可能知道,IDE和您的应用程序实际上是不同的进程。

This is true also for your development environment. If you connect your IDE to the database using embedded, then execute your application using also embedded, the application will get an access denied error, because the file will be opened by the IDE. As you may know, the IDE and your application are, in fact, different processes.

其他可能的情况是当您使用FlameRobin或任何其他数据库处理此数据库时工具(使用服务器版本或嵌入式版本),然后尝试使用嵌入式版本从IDE中打开连接。

Other possible scenario is when you're working with this database from FlameRobin or any other tool (using the server edition or the embedded one) and then you try to open the connection from the IDE using the embedded edition.

因此,使用开发环境中的嵌入式版本是个坏主意

我要做的是始终使用本地服务器。这样,我可以将我的IDE数据库工具连接到数据库(很少,但是有时我可以这样做),其他任何工具,例如isql,IBExpert,FlameRobin,我都可以维护项目中的开放连接并运行以进行测试/调试而不会出现问题。 。

What I do is always use a local server there. That way, I can connect my IDE database tools to the database (rarely, but sometimes I do that), any other tool, like isql, IBExpert, FlameRobin, I can maintain open connections from my project and run to test/debug without problems.

然后,如果应用程序将在生产环境中使用嵌入式版本,则在测试/问答阶段,我会切换到该版本,当然,

Then, if the application will use the embedded version in production, I switch to that version during the test/Q&A phase, and of course, on production.

我没有使用Visual Studio或.NET中的Firebird,所以我不确定<$ c $的含义是什么c>服务器类型:嵌入式参数,或驱动程序在服务器和嵌入式之间进行选择的方式,但是无论如何,您都必须仅在发行版中更改它,而在调试版本中使用服务器。

I'm not using Firebird from Visual Studio or .NET, so I'm not sure what's the meaning of the Server Type: Embedded parameter, or how the driver chooses between server and embedded, but whatever it is, you have to change it only in your release versions, while using server in debug versions.

现在,我必须承认,我躺在这个答案的开头,实际上使用经典服务器,有多个过程(每个连接一个客户)访问数据库。我不确定他们如何在不同进程之间共享对该文件的访问权限(也许我不知道有读写程序),这是另外一回事了,不会改变我之前说过的话。

Now, I must confess, I lie at the beginning of this answer, in fact using classic server, there are several processes (one for each connected client) accessing the database. I'm not sure how they share's access to that file between different process (maybe there are a reader/writer process, I don't know and, for now, I really don't care), that's another story and does not change what I say before.

这篇关于尝试在Visual Studio中连接到Firebird时访问拒绝错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆