与 Access 2007 中链接的 ODBC 表的持久连接
我正在尝试为 MS Access 2007 数据库实施和测试 此性能提示 ODBC 链接表。
基本上,它创建到链接数据库的持久连接。该示例使用另一个 Access 文件 (.mdb)。
就我而言,我使用来自 SQL Server 的链接表和文件 dsn。虽然我想使用用户/系统 DSN,但现在我需要使用文件 DSN。我在通过文件 DSN 和 openDatabase 方法获取连接时遇到问题。
问题:如果我只通过记录集打开其中一个表并保持打开状态,是否会看到相同的好处?
示例中的代码:
Static dbsOpen As DAO.Database
Set dbsOpen(x) = OpenDatabase("H:\folder\Backend1.mdb")
基于 CurrentDB 的记录集:
Static rs As DAO.Recordset
Set rs = CurrentDb.OpenRecordset("tablename")
I'm trying to implement and test this Performance tip for MS Access 2007 database with ODBC linked tables.
Basically it creates a persistent connection to the linked database. The example uses another Access file (.mdb).
In my case, I'm using linked tables from SQL Server with a file dsn. While I'd like to use a User/System DSN I need to work with the file DSN for now. I'm having trouble getting a connection based through the file DSN and the openDatabase method.
Question: If I just open one of the tables via recordset and keep that open will the same benefits be seen?
Code in Example:
Static dbsOpen As DAO.Database
Set dbsOpen(x) = OpenDatabase("H:\folder\Backend1.mdb")
Recordset based on CurrentDB:
Static rs As DAO.Recordset
Set rs = CurrentDb.OpenRecordset("tablename")
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
从 Access 中的持久连接获得的性能优势仅适用于 Jet/ACE 后端,即 MDB/ACCDB,因为性能提高的原因是在打开连接时创建锁定文件并持久保存为只要连接打开。创建/锁定 LDB 文件的开销相当高,这就是您要避免的,即只执行一次,而不是每次访问数据时都重做。
因此,由于它是特定于数据库引擎的优化,因此它将对 ODBC 数据源产生影响,除非该数据库也使用锁定文件(如 Jet/ACE)。
The performance benefit to be gained from a persistent connection in Access applies only to a Jet/ACE back end, i.e., MDB/ACCDB, because the reason for the performance increase is that the locking file is created when the connection is opened and persists as long as the connection is open. The overhead of creating/locking the LDB file is quite high, and that's what you're avoiding, i.e., doing it only once, rather than redoing it each time you access data.
So, since it's a database-engine-specific optimization, it will have effect at all with an ODBC data source, unless that database also uses locking files (like Jet/ACE).