Can not connect to Oracle via VBA - Driver's SQLSetConnectAttr Failed

落爺英雄遲暮 提交于 2019-12-04 02:19:54

问题


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

[Microsoft][ODBC DRIVER Manager] Driver's SQLSetConnectAttr Failed

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


回答1:


Known issue - see IBM support post. Solution - use the Oracle driver.

Also - connection strings are different between different database drivers. For example, a connection string for the Microsoft Oracle driver would look like

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.



来源:https://stackoverflow.com/questions/11203305/can-not-connect-to-oracle-via-vba-drivers-sqlsetconnectattr-failed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!