惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

罗磊的独立博客
Cisco Talos Blog
Cisco Talos Blog
C
Check Point Blog
博客园_首页
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Martin Fowler
Martin Fowler
Recorded Future
Recorded Future
S
Security @ Cisco Blogs
L
LINUX DO - 最新话题
博客园 - 司徒正美
P
Privacy International News Feed
G
Google Developers Blog
I
Intezer
Hacker News - Newest:
Hacker News - Newest: "LLM"
博客园 - 聂微东
The GitHub Blog
The GitHub Blog
C
Cybersecurity and Infrastructure Security Agency CISA
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Scott Helme
Scott Helme
K
Kaspersky official blog
I
InfoQ
Y
Y Combinator Blog
T
The Blog of Author Tim Ferriss
Webroot Blog
Webroot Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
大猫的无限游戏
大猫的无限游戏
D
Docker
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
W
WeLiveSecurity
Microsoft Azure Blog
Microsoft Azure Blog
Spread Privacy
Spread Privacy
量子位
H
Hacker News: Front Page
Simon Willison's Weblog
Simon Willison's Weblog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
SecWiki News
SecWiki News
S
Security Affairs
Latest news
Latest news
人人都是产品经理
人人都是产品经理
C
CERT Recently Published Vulnerability Notes
S
Security Archives - TechRepublic
V
Visual Studio Blog
T
Troy Hunt's Blog
S
Secure Thoughts
F
Fortinet All Blogs
V
V2EX
The Register - Security
The Register - Security
J
Java Code Geeks
MongoDB | Blog
MongoDB | Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO

博客园 - 漫步人生

c# 使用GetOleDbSchemaTable获取access数据库结构 xp上vs2010+IE8无法调试脚本 iis 上部署asp.net程序出错排查 windows2008的共享 使用sqlite绿色部署问题 在vs中使用正则表达式 事件不应该有返回值 ae的com对象在dotnet中的释放问题 adf for dotnet中servercontext的释放 修改Windows中ASPNET账户的密码 ae显示arcserver的地图服务 adf for dotnet中动态给ArcGis Server服务添加图层 js中在不知道属性名时获取属性对象 html文档中的name属性 ie中js a光标位置 adf中UpdatePanel刷新地图 windows局域网内以arcgis server local的方式连接arcserver服务器 c#与 如何调试 C#与C/C++的互操作
arcgis 编辑时独占mdb
漫步人生 · 2011-09-15 · via 博客园 - 漫步人生

在用arcmap同时编辑一个mdb时会出现错误信息“数据源已锁定”。gdb亦如此,见:http://www.gisall.com/html/32/7232-2744.html

那么在ae中具体是个什么情况呢,我以mdb为数据源来测试

1、对于单线程同时编辑的情况,打开一个workspace,对这个workspace做1000次开始编辑操作,而不结束编辑,不会出现错误

            IWorkspaceFactory wf = new AccessWorkspaceFactoryClass();
            IWorkspace ws = wf.OpenFromFile(filePath, 0);
            for (int i = 0; i < 1000; i++)
            {
                IWorkspaceEdit we = ws as IWorkspaceEdit;
                we.StartEditing(false);
                we.StartEditOperation();
            }
如果打开1000次workspace,并开始编辑,而不结束编辑操作,也不会出现错误
            for (int i = 0; i < 1000; i++)
            {
                IWorkspaceFactory wf = new AccessWorkspaceFactoryClass();
                IWorkspace ws = wf.OpenFromFile(filePath, 0);
                IWorkspaceEdit we = ws as IWorkspaceEdit;
                we.StartEditing(false);
                we.StartEditOperation();
            }
2、多线程同时编辑的情况,在100个线程里打开100次workspace,并开始编辑,而不结束编辑,也不会出错
            ThreadStart ts = delegate()
            {
                try
                {
                    IWorkspaceFactory wf = new AccessWorkspaceFactoryClass();
                    IWorkspace ws = wf.OpenFromFile(filePath, 0);
                    IWorkspaceEdit we = ws as IWorkspaceEdit;
                    we.StartEditing(false);
                    we.StartEditOperation();
                }
                catch (Exception ex) { MessageBox.Show(ex.Message); }
            };
            for (int j = 0; j < 100; j++)
            {
                Thread t1 = new Thread(ts);
                t1.Start();
            }
3、多进程同时编辑的情况,在2个进程里打开workspace,并开始编辑,而不结束编辑,在第二个进程开始编辑的时候得到一个COMException的异常,
描述为:“无法锁定数据表GDB_DatabaseLocks;正被机器 '机器名' 上的用户 '用户名' 使用。”。而如果第一个进程开始编辑后结束编辑,第二个进程再开始编辑,是不会出错的。
所以,ae的编辑锁(不知道叫啥名,乱取的)是针对进程,而且是针对同时编辑的情况。
无论ae还是arcgis在开始编辑一个mdb后,通过office access软件是可以查看被编辑mdb的除GDB_DatabaseLocks以外的所有表的,查看GDB_DatabaseLocks表就会提示被独占方式打开。
奇怪的是,即使是在开始编辑以锁定GDB_DatabaseLocks表的ae程序进程里,通过OleDb查询或用IFeatureWorkspace的OpentTable方法都会得到被独占的异常。代码如下:
            IWorkspaceFactory wf = new AccessWorkspaceFactoryClass();
            IWorkspace ws = wf.OpenFromFile(filePath, 0);
            IWorkspaceEdit we = ws as IWorkspaceEdit;
            we.StartEditing(false);
            we.StartEditOperation();
            ITable temT = ((IFeatureWorkspace)ws).OpenTable("GDB_DatabaseLocks");