如何允许 1 个用户更新数据库,同时允许其他人仅在 Microsoft Access 中读取? [英] How to enable 1 user to update the database while allowing others to only read in Microsoft Access?

查看:30
本文介绍了如何允许 1 个用户更新数据库,同时允许其他人仅在 Microsoft Access 中读取?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我计划将我的带有表单和数据库的 Microsoft Access 应用程序放到一个共享驱动器上,供大约 10 多人使用.但是,存在并发问题.有没有办法设置它,例如允许Microsoft Access数据库在任何时候仅由1个人更新,而允许其他人阅读但不更新?目前,访问数据库只能由一个人更新和读取,而其他人甚至无法打开文件.非常感谢您提供的任何帮助!

I am planning to put my microsoft access application with forms and database onto a shared drive for around 10+ people to use. However, there is the issue of concurrency. Is there any way to set it such as to allow the microsoft access database to be only updated by 1 person at any one time while allowing others to read it but not update it? For now, the access database can only be updated and read by a single person while the others cannot even open the file. Thanks a lot for any help rendered!

推荐答案

我想要做的是只允许 1 人能够更新数据库,而其他人则是只读的.

What i want to do is allowing only 1 person to be able to update the database while others will read-only.

是的,可以做到,而且您无需更改应用程序代码即可做到.可以通过调整共享文件夹和共享文件的权限来实现.

Yes, it can be done, and you don't need to change your application code to do it. It can be accomplished by adjusting the permissions on the shared folder and the shared file.

文件夹权限

每当一个或多个用户需要对 ACE/Jet 数据库文件(.accdb 或 .mdb)进行读/写访问时,所有用户都必须具有创建文件/写入数据 对文件所在的文件夹的权限.这是因为如果他们是第一个进入数据库的人,他们的 Access 数据库引擎副本需要能够创建锁定文件(.laccdb 或 .ldb).

Whenever one or more users need read/write access to an ACE/Jet database file (.accdb or .mdb), all users must have Create files / write data permission on the folder in which the file resides. This is because their copy of the Access Database Engine needs to be able to create the lock file (.laccdb or .ldb) if they are the first person into the database.

请注意,即使是对文件仅有只读访问权限的用户,仍然需要对文件夹的创建文件"权限.这是必不可少的.

Note that even users who will just have read-only access to the file still need "Create files" permission on the folder. This is essential.

文件权限(.accdb 或 .mdb)

在这里您可以区分可以更新数据库的用户和仅具有只读访问权限的用户.只需使用 文件 上的 Windows 权限即可根据需要授予他们读+写或只读权限.

This is where you differentiate between users who can update the database, and users with just read-only access. Simply use the Windows permissions on the file to give them read+write or read-only permissions as desired.

常见错误 #1:在文件夹上设置用户/组权限(读写或只读),并让数据库文件(.accdb 或 .mdb)继承它们

在这种情况下,读+写"用户可以创建锁定文件,但只读"用户不能.

In this situation, "read+write" users can create the lock file but "read-only" users cannot.

•场景 A: 如果读+写"用户首先打开数据库,则会创建锁定文件,一切都按预期运行.附加的读+写"用户可以打开数据库并进行更新,附加的只读"用户以只读方式打开数据库.

• Scenario A: If a "read+write" user opens the database first then the lock file gets created and everything operates as expected. Additional "read+write" users can open the database and make updates, and additional "read-only" users open the database read-only.

•方案 B: 如果只读"用户首先打开数据库文件,则他们的 Access 副本按预期以只读方式打开文件.但是,如果读+写"用户(根据他们的文件权限)然后尝试打开数据库文件,他们也会以只读方式打开它.每个人都可以进入,但没有人可以改变.

• Scenario B: If a "read-only" user opens the database file first, then their copy of Access opens the file as read-only, as expected. However, if a "read+write" user (according to their file permissions) then tries to open the database file they will open it as read-only too. Everyone can get in, but nobody can make changes.

常见错误#2:禁止在文件夹中为所有人创建文件"

在这种情况下,没有人可以创建锁定文件,因此每个人都以只读方式打开数据库,而不管他们对数据库文件本身的权限如何.

In this case nobody can create the lock file so everybody opens the database read-only, regardless of their permissions on the database file itself.

附加说明:

以上结果通过 Access_2010 和 Access_2013 客户端的混合连接到 Windows Server 2012 上的共享 .accdb 后端得到确认.在早期版本的 Access 中,如果没有人可以创建锁定文件,那么第一个进入"的人将以独占模式"打开数据库文件并获得其文件权限允许的任何访问权限,而所有后续用户将被拒绝访问并显示错误消息,指出该文件已被另一用户独占打开."em>

The results above were confirmed with a mix of Access_2010 and Access_2013 clients connecting to a shared .accdb back-end on Windows Server 2012. In earlier versions of Access, if nobody could create the lock file then the first person "in" would open the database file in "Exclusive mode" and get whatever access their file permissions allowed, while all subsequent users would be denied access with an error message stating that "The file has been opened exclusively by another user."

这篇关于如何允许 1 个用户更新数据库,同时允许其他人仅在 Microsoft Access 中读取?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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