开发过程中要用C++ 连接oracle 数据库,但是由于数据库的密码不知道,所有用系统验证的方式连接数据库,但是查询了网上的各种资料,一直都无法连接上数据库.
参考到的资料有.
http://www.codeproject.com/Articles/2304/ADO-Connection-Strings
http://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组里面了的)