Access 数据库已被另一个用户以独占方式打开

发布于 2024-12-17 08:52:20 字数 644 浏览 0 评论 0原文

我有一个位于服务器 x 上的访问数据库,iis 正在服务器 y 上运行。我的网页之一从访问数据库访问数据。如果有人打开了访问数据库,例如我们网络上的最终用户,则网页会失败,并显示“...已由另一个用户独占打开”错误消息。

我创建了一个本地访问数据库并使用链接表以便以这种方式访问​​表。即使如此,我仍然收到已由另一个用户独占打开的错误。如果我通过 Windows 资源管理器浏览到服务器 x 并打开数据库,我可以毫无问题。所以我的问题是如何模拟与数据库的相同类型的连接而不引发错误,这是访问数据库的权限问题还是连接字符串中允许我访问数据库的内容。

由于它在我的 connection.open 命令期间抛出错误,我认为它要么与权限相关,要么与我需要添加到连接字符串中的其他内容有关。我已授予对访问数据库的本地实例所在的本地目录上的 IIS AppPool\ 的完全控制权,但似乎没有什么区别。

我的连接字符串如下所示:

Private Shared connSheriff As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\serverx\directory\Access\MyDatabase.mdb;Jet OLEDB:Database Password=property;")

I have an access database that sits on server x iis is running on server y. One of my web pages access data from the access database. If someone has the access database open say a end user on our network the web pages fail with a ...already opened exclusively by another user error message.

I created a local access database and used linked tables in order to access the tables that way. Even still I get the already opened exclusively by another user error. If I go through windows explorer and browse out to server x and open the database I can without issue. So my question is how can I simulate the same type of connectivity to the database without the error being thrown is it a matter of permissions to the access database or something within my connectionstring that would allow me to access the database.

Since it throws the error during my connection.open command I am figuring it is either permission related or something additional I need to add to my connection string. I have granted full control for the IIS AppPool\ on the local directory in which my local instance of the access database resides in but didn't seem to make a difference.

My connection string looks like:

Private Shared connSheriff As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\serverx\directory\Access\MyDatabase.mdb;Jet OLEDB:Database Password=property;")

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

高冷爸爸 2024-12-24 08:52:20

有一些 mdb 中的选项 更改数据库默认打开方式,这些应该是您的第一个调用端口,特别是将“默认打开模式”设置为“共享”。

您已经拆分了数据库(共享后端中的数据表、链接表以及前端中的其余部分)。确保每个用户使用前端 mdb 的单独副本,否则您将遇到锁定问题。

有一个命令行开关(/excl)可以设置独占模式,但是您只需忽略它即可打开共享数据库,所以我怀疑这是一个问题。

您可能已经知道这一点,但“共享”修饰符没有任何内容与应用程序或用户之间的共享有关,但在类的实例之间共享连接变量(C# 等效项是“静态”)

There are some options within the mdb that change how the database is opened by default, these should be your first port of call particularly setting the "default open mode" to "shared".

You've already split the database (data tables in the shared back-end, linked tables and the rest in the front-end). Make sure that each user uses a separate copy of the front-end mdb, otherwise you'll get locking issues on this.

There is a command line switch (/excl) that sets exclusive mode, but you just omit this to open the db shared so I doubt this is a problem.

You probably already know this but the "Shared" modifier has nothing to do with sharing between applications or users, but shares the connection variable between instances of your class (the c# equivalent is "static")

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文