Persistant Connection to linked ODBC tables in Access 2007
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 u开发者_StackOverflow社区sing 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")
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).
精彩评论