命令行将路径更改为MS Access ODBC系统DSN的.mdb文件?

问题描述:

我可以使用哪个odbcconf.exe命令行来更改已存在的系统DSN的MS Access .mdb文件的路径?

What odbcconf.exe command line can I use to change the path to the MS Access .mdb file for an already existing System DSN?

要回答所问的问题,以下是使用odbcconf.exe而不直接进入注册表的解决方案:

To answer the question as asked, here is a solution using odbcconf.exe instead of going straight to the registry:

odbcconf.exe configsysdsn ^
  "Microsoft Access Driver (*.mdb, *.accdb)" ^
  "DSN=OurConnectionName;DBQ=X:\Path\to\OurMsAccessDB.mdb"

让我绊了一会儿的两个笔记:

Two items of note which had me tripped up for a while:

  • 确保在64位系统上使用64位odbcconf.exe,请参阅
  • make sure you use 64bit odbcconf.exe when on a 64bit system, see https://stackoverflow.com/questions/6721702/windows-7-64-bit-odbc-drivers-for-ms-access-missing.
  • use DBQ= and not Database= for the mdb path. When using the latter everything appears to work, however the connection link is named but not actually defined in the ODBC Administrator.