MS Access 数据访问限制
我现在有一个项目,我希望能够从第三方产品用来存储其信息的 Access 数据库中提取行。 可能会有少数用户在我的“导出”过程的同时访问此数据库,因此我有点担心数据完整性和并发访问。
当我的 .NET 导入过程(使用 LINQ/ADO.NET/?)在其他人保存行的同时尝试从 MDB 中提取数据时,我是否可能会遇到问题? Access 的锁定是如何工作的?
I have a project right now where I'd like to be able to pull rows out of an Access database that a 3rd party product uses to store its information. There will likely be a small number of users hitting this database at the same time my "export" process does, so I'm a little concerned about data integrity and concurrent access.
Will I likely run into problems with my .NET import process (using LINQ/ADO.NET/?) when it is trying to pull data out of the MDB at the same time someone else is saving a row? How does Access's locking work?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
应该没有问题。 仅在并发写入操作时才会出现问题。 MS Access 的锁定基于 ldb 文件中的文件锁。 锁定仅发生在页面上,而不发生在整个文件上。 因为锁位于ldb文件中而不是mdb文件中,所以并行读取没有问题。
There should no problem. Problems can occur only on concurrent write operations. The locking from MS Access based on file locks in the ldb file. The locks occur only on pages and not on the completely file. Because the locks are in the ldb file and not in the mdb file that there are no problems with parallel reading.
在以前使用 Access 的过程中(当我使用 2003 时),我遇到的唯一问题是读取偶尔会锁定当前读取上方和下方的行。 但是,我相信这可能是我们应用程序的一个孤立问题。
In previous workings with Access (back when I was using 2003 for things) the only thing I ran into was that occasionally a read would lock rows just above and below the current read. However, I believe this may have been an isolated issue with our application.
当您打开数据库时,不要尝试以只读模式打开(尽管您可能认为这是有道理的)。 当您是第一个用户时,Access 以只读模式打开 mdb 文件,并且不会创建 ldb,从而强制所有后续用户也处于只读模式。
When you open the database, do not attempt to open in read-only mode (although you might think it makes sense). When you are the first user in, Access opens the mdb file in read-only mode and does not create an ldb, forcing all subsequent users to be in read-only mode as well.