Click here to Skip to main content
15,885,309 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a question, I use c++ connect oracle database,i want use OS Authenticated to connect the oracle database,but i always failed,I have try many means to try,but all are can't do it.

these are i had use ,but can't do it.

OLE DB Provider for Oracle (from Oracle).
For Standard security:

strConnect = _T("Provider=OraOLEDB.Oracle;Data Source=MyOracleDB;"
"User Id=myUsername;Password=myPassword;");

For a Trusted connection:

OS Authenticated connect setting user ID to "/":
strConnect = _T("Provider=OraOLEDB.Oracle;Data Source=MyOracleDB;"
"User Id=/;Password=;");

OS Authenticated connect using OSAuthent:
strConnect = _T("Provider=OraOLEDB.Oracle;Data Source=MyOracleDB;OSAuthent=1;")


anyone have other good ideals!!!!!!!!!!!!!!!
Posted
Comments
KarstenK 15-May-14 4:18am    
what are the error codes? Maybe something earlier goes wrong.
Code-o-mat 15-May-14 16:11pm    
No idea if this will be any useful to you or not, but once we ran into a crazy, seemingly unexplainable connection-failure when trying to connect to an oracle database. After a lot of headbanging and googling we found out that the problem was that our 32 bit software was installed on a 64 bit system and thus it was under c:\program files (x86)\... and for some reason the path of the executable is used by oracle when establishing a connection BUT if the path contains parentheses it gets rejected.

There's no indication whatsoever if this could be your problem, i just thought i share it just in case...maybe one day someone reading your post will read this too and it will be just what was needed.
JJMatthews 23-May-14 3:45am    
I talk to Oracle with ADO, heres an example of my connection string, hope it helps:

m_cstrDBCon = _T("Provider=OraOLEDB.Oracle;");
m_cstrDBCon += _T("dbq=127.0.0.1:1521/XE;Database=DBNAME;");
m_cstrDBCon += _T("User Id=Admin;Password=****;");

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900