问题描述
- c++ ADO 连接ORACLE 数据库 windows系统验证方式连接老是失败.
-
开发过程中要用C++ 连接oracle 数据库,但是由于数据库的密码不知道,所有用系统验证的方式连接数据库,但是查询了网上的各种资料,一直都无法连接上数据库.参考到的资料有.
http://www.codeproject.com/Articles/2304/ADO-Connection-Stringshttp://www.connectionstrings.com/oracle/
代码:
OLE DB Provider for Oracle (from Oracle).
For Standard security:Collapse | Copy Code
strConnect = _T("Provider=OraOLEDB.Oracle;Data Source=MyOracleDB;"
"User Id=myUsername;Password=myPassword;");
For a Trusted connection:OS Authenticated connect setting user ID to "/":
Collapse | Copy Code
strConnect = _T("Provider=OraOLEDB.Oracle;Data Source=MyOracleDB;"
"User Id=/;Password=;");
OS Authenticated connect using OSAuthent:
Collapse | Copy Code
strConnect = _T("Provider=OraOLEDB.Oracle;Data Source=MyOracleDB;OSAuthent=1;")
Note: "Data Source=" must be set to the appropriate Net8 name which is known to the naming method in use. For example, for Local Naming, it is the alias in the tnsnames.ora file; for Oracle Names, it is the Net8 Service Name.For more information, see: Oracle Provider for OLE DB Developer's Guide.
求大神指导啊,好几天了,就是无法用系统的验证连接数据库(Administrator用户已经加入到SYSDBA组里面了的)
解决方案
你不用ADO,使用OLEDE 使用者模板!你添加模板的时候,就叫你选择provider,登陆的id和密码,并且可以测试数据库连接,连接成功之后,就可以选择数据库中你要操作的表,最后确定,就可以了