mysql odbc参数_Mysql ODBC 连接Mysql参数的问题

之前使用ODBC连接Mysql时,希望将Conection String写入代码,可以动态生成,并在必要的时候才注册ODBC数据源。在http://www.connectionstrings.com上找到了Connection String的写法:“DRIVER={MySQL ODBC 3.51 Driver};SERVER=localhost;PORT=3306;DATABASE=test; USER=root;PASSWORD=***;OPTION=3;”。在Connection String的数据项中,只有OPTION一项不知如何下手,猜测是配置ODBC中需要的一些数据项,却不知道数据项具体和OPTION如何关联。

今天下载了MySQL ODBC 3.51 Driver的代码,试图分析配置时写入的文件,未果,却发现了一个文档,MySQL ODBC 3.51 Driver - DSN Configuration Help,找到了OPITION具体数值的含义,根据文档的描述,动态写了CONNECTION STRING,并将OPTION设置为4099,连接数据库,成功!解决了Mysql ODBC配置中必须选择Return Matching Rows和Ignores Space After Function Names两个选项的问题。

Mysql ODBC 的每个选项都有具体的数值与之对应,具体的数值赋给OPTION就可以正确连接了。

如果需要设置多个选项,将选项对应的值相加即可:

If you want to have many options, you should add the above flags! For example setting option to 12 (4+8) gives you debugging without package limits!

OPTION数值的具体含义如下:1 If the client wants the real width of the column.2  The client can't handle that MySQL returns the true value of affected rows. If this flag is set then MySQL returns 'found rows' instead. One must have MySQL 3.21.14 or newer to get this to work. 4  Make a debug log in c:/myodbc.log. This is the same as putting MYSQL_DEBUG=d:t:O,c::/myodbc.log in `AUTOEXEC.BAT'  - ?Enabled only in debug mode8 Don抰 set any packet limit for results and parameters16  Don't prompt for questions even if driver would like to prompt 32  Enable or disable the dynamic cursor support. This is not allowed in MyODBC. 64 Ignore use of database name in database.table.column?128  Force use of ODBC manager cursors (experimental). 256  Disable the use of extended fetch (experimental) 512  Pad CHAR fields to full column length. 1024  SQLDescribeCol () will return fully qualified column names 2048  Use the compressed server/client protocol 4096  Tell server to ignore space after function name and before '(' (needed by PowerBuilder). This will make all function names keywords! 8192  Connect with named pipes to a mysqld server running on NT. 16384  Change LONGLONG columns to INT columns (Some applications can't handle LONGLONG). 32768  Return 'user' as Table qualifier and Table owner from SQLTables (experimental) 65536  Read parameters from the client and odbc groups from `my.cnf' 131072  Add some extra safety checks (should not bee needed but...) 262144 Disable transactions524288 Write all queries to `c:/myodbc.sql` (`/tmp/myodbc.sql`) ?Enabled only in debug mode1048576 Do not cache the results locally in the driver, instead read from server (`mysql_use_result`). This works only for forward-only cursor types. This option is very important in dealing with large tables when one doesn't want the driver to cache the entire result set.2097152 Force the use of 'Forward-only' cursor type. In case of applications setting the default static/dynamic cursor type, and one wants driver to use non-cache result sets, then this option will ensure the forward-only cursor behavior.

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值