简体   繁体   English

关闭iODBC跟踪

[英]Turning off iODBC tracing

I'm using iODBC on OS X 10.6.8 agains MySQL (mysql-connector-odbc-5.1.8) from a C program that I'm writing, but tracing of all ODBC library calls, which is supposed to be turned off by default, is turned on. 我在OS X 10.6.8上使用iODBC,再次从我正在编写的C程序中使用MySQL(mysql-connector-odbc-5.1.8),但跟踪所有ODBC库调用,这应该由来关闭默认为打开。

I have found a set of odbc.ini and odbcinst.ini files in /etc and in /Library/ODBC/ , but none of them contains "Trace = yes", and adding an [ODBC] section with "Tracing = no" to any of these files doesn't seem to do anything. 我在/etc/Library/ODBC/找到了一组odbc.iniodbcinst.ini文件,但是它们都不包含“ Trace = yes”,并向其中添加了“ Tracing = no”的[ODBC]部分这些文件似乎没有任何作用。 I also do not have any private .odbc.ini or .odbcinst.ini files in the working directory nor in my home directory nor anywhere else. 在工作目录,主目录或其他任何地方,我也没有任何私有.odbc.ini.odbcinst.ini文件。

The only way I can turn tracing off is to call SQLSetConnectAttr() to set SQL_ATTR_TRACE to SQL_OPT_TRACE_OFF after allocating a connection handle, but at that point, the trace file, sql.log , has already been created in the working directory. 我可以关闭跟踪的唯一方法是,在分配连接句柄后,调用SQLSetConnectAttr()SQL_ATTR_TRACE设置为SQL_OPT_TRACE_OFF ,但是此时,跟踪文件sql.log已经在工作目录中创建了。

Any help with tracking down where tracing is turned on (it's supposed to be off by default), alternatively, how to turn it off so that the log file never gets created, would be appreciated. 任何有关跟踪打开位置(默认情况下应该关闭)的帮助,或者如何将其关闭以使日志文件永远不会被创建的帮助将不胜感激。

The default settings files for ODBC on Mac OS X are found at -- 在Mac OS X上,ODBC的默认设置文件位于-

/Library/ODBC/odbc.ini
/Library/ODBC/odbcinst.ini
/Users/*/Library/ODBC/odbc.ini
/Users/*/Library/ODBC/odbcinst.ini

The first two are for system-level settings and DSNs; 前两个用于系统级设置和DSN。 the latter are for user-level. 后者是针对用户级别的。

Some buggy installers and libraries create files at -- 一些错误的安装程序和库会在以下位置创建文件:

/Users/*/.odbc.ini
/Users/*/.odbcinst.ini
/etc[/*]/.odbc.ini
/etc[/*]/.odbcinst.ini
/etc[/*]/odbc.ini
/etc[/*]/odbcinst.ini

These can lead to trouble. 这些会导致麻烦。 This command will reveal all potentially trouble-making files -- 此命令将显示所有可能造成麻烦的文件-

sudo find / \( -name '.odbc*.ini' -or -name 'odbc*.ini' \) -ls

Best is to -- 最好是-

  1. blend the content of existing non-default files into the default locations, and drop the non-default files 将现有非默认文件的内容混合到默认位置,然后删除非默认文件
  2. create symlinks from the buggy .odbc[inst].ini locations to the default files 创建从错误的.odbc [inst] .ini位置到默认文件的符号链接
  3. update the iODBC components on your Mac 在Mac上更新iODBC组件
  4. enjoy trouble free ODBC use 享受无故障的ODBC使用

(ObDisclaimer: I am an employee of OpenLink Software , who maintain and support the iODBC project , which is the ODBC Driver Manager chosen by Apple for Mac OS X, bundled since Jaguar (10.2.x).) (声明:我是OpenLink Software的雇员,他维护和支持iODBC项目 ,该项目是Apple为Mac OS X选择的ODBC驱动程序管理器,自Jaguar(10.2.x)起捆绑销售。)

I'm not sure why you would be using odbc instead of the standard connector, but have you tried setting the option for the TraceFile to /dev/null in odbc.ini. 我不确定为什么要使用odbc而不是标准连接器,但是在odbc.ini中尝试将TraceFile的选项设置为/ dev / null。 This may at least remove the file if you can't get the Trace = OFF to work by itself. 如果您无法单独使用Trace = OFF,则至少可以删除该文件。

[ODBC]
Trace = OFF
TraceFile = /dev/null

Don't have my Mac at the office to test this, but seems like it should work. 不要在办公室使用我的Mac进行测试,但似乎应该可以使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM