ODBCCONF.EXEODBCCONF.EXE

ODBCCONF.exe 是一种命令行工具,可用于配置 ODBC 驱动程序和数据源的名称。ODBCCONF.exe is a command-line tool that allows you to configure ODBC drivers and data source names.

备注

Windows 数据访问组件的未来版本中将删除 ODBCCONF.exe。ODBCCONF.exe will be removed in a future version of Windows Data Access Components. 避免使用此功能,并计划修改当前使用此功能的应用程序。Avoid using this feature, and plan to modify applications that currently use this feature. 可以使用 PowerShell 命令来管理驱动程序和数据源。You can use PowerShell commands to manage drivers and data sources. 有关这些 PowerShell 命令的详细信息,请参阅 Windows 数据访问组件 cmdletFor more information about these PowerShell commands, see Windows Data Access Components cmdlets.

语法Syntax

ODBCCONF [switches] action  

参数Arguments

交换器switches
零个或多个开关选项。Zero or more switch options. 有关可用开关的列表,请参阅本主题后面的 "备注" 部分。For the list of available switches, see the Remarks section, later in this topic.

actionaction
要执行的一项操作。One action to perform. 有关可用选项的列表,请参阅 "备注" 部分。For the list of available options, see the Remarks section.

备注Remarks

以下开关可用:The following switches are available:

开关Switch 说明Description
/A {操作}/A {action} 指定操作。Specify an action.

如果只指定了一个操作,则/a 是可选的。/A is optional if only one action is specified.
/?/? 显示 ODBCCONF.EXE 的使用情况。Display usage for ODBCCONF.EXE.
/C/C 如果操作失败,处理将继续进行。Processing continues if an action fails.
/E/E 处理完成后,清除用/F 指定的响应文件。Erase the response file specified with /F when processing is finished.
/F/F 使用响应文件,如 odbcconf /F my.rspUse a response file, such as odbcconf /F my.rsp.

rsp 可能如下所示: REGSVR c:\my.dllmy.rsp might look like this: REGSVR c:\my.dll

/A 不用于响应文件。/A is not used in a response file.
/H/H 显示用法 (帮助) 。Display usage (Help). 此开关与/?相同。This switch is the same as /?.
/L [mode] filename/L[mode] filename 以三种模式之一将程序输出发送到文件:正常 (n) 、verbose (v) ,并调试 (d) 。Send program output to a file in one of three modes: normal (n), verbose (v), and debug (d). 调试模式记录 odbcconf.exe 加载的 Dll。Debug mode records the DLLs that are loaded by odbcconf.exe.

如果在不使用模式的情况下指定/L,则日志文件将为空。If you specify /L without a mode, the log file will be empty.

例如, /Lv log.txtFor example, /Lv log.txt.
/R/R 操作将在重新启动后执行。The action will be performed after a reboot.
/S/S 静默模式。Silent mode. 不显示错误消息。Do not display error messages.

提供了以下选项:The following actions are available:

操作Action 描述Description
CONFIGDRIVER driver_name * * 驱动程序特定的配置参数CONFIGDRIVER driver_name**driver-specific configuration params 加载相应的驱动程序安装程序 DLL 并调用 ConfigDriver 函数。Loads the appropriate driver setup DLL and calls the ConfigDriver function.

等效于 SQLConfigDriver 函数Equivalent to the SQLConfigDriver function.

例如:For example:

/A {CONFIGDRIVER "Driver Name" "CPTimeout = 60"}/A {CONFIGDRIVER " Driver Name" "CPTimeout=60"}

/A {CONFIGDRIVER "Driver Name" "DriverODBCVer = 03.80"}/A {CONFIGDRIVER " Driver Name" "DriverODBCVer=03.80"}
CONFIGDSN driver_name DSN =name | 属性CONFIGDSN driver_name DSN=name | attributes 添加或修改系统数据源。Adds or modifies a system data source.

等效于 SQLConfigDataSource 函数Equivalent to the SQLConfigDataSource function.

例如:For example:

/A {CONFIGDSN "SQL Server" "DSN = name | Server = srv"}/A {CONFIGDSN "SQL Server" "DSN=name | Server=srv"}
CONFIGSYSDSN driver_name DSN =name | 属性CONFIGSYSDSN driver_name DSN=name | attributes 添加或修改系统数据源。Adds or modifies a system data source.

等效于 SQLConfigDataSource 函数Equivalent to the SQLConfigDataSource function.

例如:For example:

/A {CONFIGSYSDSN "SQL Server" "DSN = name | Server = srv"}/A {CONFIGSYSDSN "SQL Server" "DSN=name | Server=srv"}
INSTALLDRIVERINSTALLDRIVER 等效于 SQLInstallDriverEx 函数Equivalent to SQLInstallDriverEx Function.

有关传递到 INSTALLDRIVER 的关键字值对语法的信息,请参阅 驱动程序规范子项For information about the keyword-value pairs syntax passed to INSTALLDRIVER, see Driver Specification Subkeys.

例如:For example:

/A {INSTALLDRIVER "Driver | Driver =c:\your.dll | Setup =c:\your.dll | APILevel = 2 | ConnectFunctions = YYY | DriverODBCVer = 03.50 | FileUsage = 0 | SQLLevel = 1"}/A {INSTALLDRIVER "Your Driver | Driver=c:\your.dll | Setup=c:\your.dll | APILevel=2 | ConnectFunctions=YYY | DriverODBCVer=03.50 | FileUsage=0 | SQLLevel=1"}
INSTALLTRANSLATOR 转换器配置 * * 驱动程序路径INSTALLTRANSLATOR translator configuration**driver path 将有关转换器的信息添加到 HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI \Odbc 转换器 注册表项。Adds information about a translator to the HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\ODBC Translators registry key.

等效于 SQLInstallTranslatorEx 函数Equivalent to SQLInstallTranslatorEx Function.

有关传递到 INSTALLDRIVER 的关键字/值对语法的信息,请参阅 转换器规范子项For information about the keyword-value pairs syntax passed to INSTALLDRIVER, see Translator Specification Subkeys.

例如:For example:

/A {INSTALLTRANSLATOR "我的翻译 | Translator =c:\my.dll | 安装程序 =c:\my.dll"}/A {INSTALLTRANSLATOR "My Translator | Translator=c:\my.dll | Setup=c:\my.dll"}
REGSVR dllREGSVR dll 注册 DLL。Registers a DLL.

等效于 regsvr32.exe。Equivalent to regsvr32.exe.

例如:For example:

/A {REGSVR c:\my.dll}/A {REGSVR c:\my.dll}
SETFILEDSNDIRSETFILEDSNDIR 如果不存在 HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI \ODBC 文件 DSN\DefaultDSNDir,则 SETFILEDSNDIR 操作会创建该文件,并为其分配 HKEY_LOCAL_MACHINE \SOFTWARE\Microsoft\Windows\CurrentVersion\CommonFilesDir 上的值,并在 \ODBC\Data 源后面追加。When HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\ODBC File DSN\DefaultDSNDir does not exist, the SETFILEDSNDIR action will create it and assign it the value at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\CommonFilesDir, appended with \ODBC\Data Sources.

在创建基于文件的数据源时,HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI \ODBC 文件 DSN\DefaultDSNDir 的值指定 ODBC 数据源管理器使用的默认位置。The value at HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\ODBC File DSN\DefaultDSNDir specifies the default location used by the ODBC Data Source Administrator when creating a file-based data source.

例如:For example:

/A {SETFILEDSNDIR}/A {SETFILEDSNDIR}

另请参阅See Also

Microsoft 开放式数据库连接 (ODBC)Microsoft Open Database Connectivity (ODBC)