sqlplus login v. login via OCCI

10 views
Skip to first unread message

Shane

unread,
Mar 27, 2009, 4:46:09 PM3/27/09
to Oracle PL/SQL
This works great:

$ sqlplus smiller/mill@oradev


But connecting to the same db from the same box with this OCCI C++:


std::string user("smiller");
std::string pswd("mill");
std::string db("oradev");
Environment *env = Environment::createEnvironment();
Connection *conn = env->createConnection(user,pswd,db);


gives


ORA-01017: invalid username/password; logon denied


what stupid thing am I missing?


Jens

unread,
Mar 29, 2009, 5:15:05 PM3/29/09
to Oracle PL/SQL
Not familiar with OCCI C++, but in general your environment has to be
set up correctly. For your bash this is normally already the case but
I see that you're initializing an environment object. Maybe you need
to copy the settings from your bash environment to your object. E.g
say your bash environment variables look something like this:

NLS_DATE_FORMAT='YYYY-MM-DD-HH24:MI:SS';
ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server;
# etc ...

Then you have to set your environment like this.

env->oracleHome = '/usr/lib/oracle/xe/app/oracle/product/10.2.0/serv';
env->NLSDateFormat = 'YYYY-MM-DD-HH24:MI:SS';
// etc. ...

Hope this helps
Reply all
Reply to author
Forward
0 new messages