微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

oracle – SQLDriverConnect有时会在{}中包含密码时失败

根据sqlDriverConnect的 documentation,

Because of connection string and initialization file grammar,keywords and attribute values that contain the characters []{}(),;?*=!@ not enclosed with braces should be avoided.

A DSN or connection string value enclosed with braces ({}) containing any of the characters []{}(),;?*=!@ is passed intact to the driver.

使用连接字符串DSN =%s; UID =%s; PWD = {%s}在sqlServer中工作 – 事实上,如果存在某些特殊字符,则不在{}中包含密码失败.但是,对MS Access使用相同的字符串会因“密码无效”而失败,并且在删除{}时有效.它也不适用于Oracle.

如果{}中包含的字符串完整地传递给服务器,那么它不应该工作吗?或者我错过了什么?

解决方法

SQLDriverConnect’s Access-specific page指出:

The PWD keyword should not include any of the special characters (see sql_SPECIAL_CHaraCTERS in sqlGetInfo Returned Values).

在连接到Access并将sql_SPECIAL_CHaraCTERS作为InfoType参数传递时调用SQLGetInfo function应该返回@Andrew Gibson提到的禁用字符.

knowledge base article的“更多信息”部分包含不建议在Access应用程序中使用的特殊字符列表.

IBM的DB2具有相同名称SQLGetInfo function,具有相同的参数列表,并采用相同的InfoType常量来返回特殊字符,其中列出如下:

all characters except a…z,A…Z,0…9,and underscore

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐