无法通过 VBA 连接到 Oracle - 驱动程序的 SQLSetConnectAttr 失败
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11203305/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Can not connect to Oracle via VBA - Driver's SQLSetConnectAttr Failed
提问by logan
I have created an ODBC connection for oracle using "Microsoft ODBC for Oracle" driver under user DSN. I can connect to oracle 10g using SQL developer but when i try to connect via ODBC its saying
我在用户 DSN 下使用“Microsoft ODBC for Oracle”驱动程序为 oracle 创建了 ODBC 连接。我可以使用 SQL developer 连接到 oracle 10g,但是当我尝试通过 ODBC 连接时,它说
[Microsoft][ODBC DRIVER Manager] Driver's SQLSetConnectAttr Failed
[Microsoft][ODBC DRIVER Manager] 驱动程序的 SQLSetConnectAttr 失败
I have tried following code for connecting.
我尝试过以下代码进行连接。
data_src = Oracle
Database = sys
Uid = <my id>
pwd = <my pwd>
Set cn=new ADOBB.Connection
Cn.open "DataSource=" + data_src + ";" + Database + "; persist security Infor = True; UserID= " + Uid + "; Password=" + pwd + "; SessionMode = ANSI;"
I have already connected to Teradata using same code with different setting. Please help me to connect Oracle 10g from VBA
我已经使用具有不同设置的相同代码连接到 Teradata。请帮我从 VBA 连接 Oracle 10g
采纳答案by Bob Jarvis - Reinstate Monica
Known issue - see IBM support post. Solution - use the Oracle driver.
已知问题 - 请参阅IBM 支持帖子。解决方案 - 使用 Oracle 驱动程序。
Also - connection strings are different between different database drivers. For example, a connection string for the Microsoft Oracle driver would look like
此外 - 不同数据库驱动程序之间的连接字符串不同。例如,Microsoft Oracle 驱动程序的连接字符串看起来像
Driver={Microsoft ODBC for Oracle};Server=myServerAddress;Uid=myUsername;Pwd=myPassword;
while one for Oracle's own driver would be similar to
而甲骨文自己的驱动程序将类似于
Driver={Oracle in OraHome92};Dbq=myTNSServiceName;Uid=myUsername;Pwd=myPassword;
Share and enjoy.
分享和享受。