Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Connecting Oracle 9i Server via a C++ application written using the OTL lib

509382Apr 27 2006 — edited May 13 2009
I am looking for somebody has experience writing client applications for Oracle 9 using the OTL framework: http://otl.sourceforge.net/

I am using this free open source software to write my client, but the first stopper was to having my client application to connect to the Oracle Server. (Oracle version 9.2.0.4)

Using the sqlplus client I am able to connect to the user SYSTEM with the following command line: sqlplus "SYSTEM/manager as SYSDBA".

But, if I set in my C++ client the connect string for otl_connect::rlogon() to "SYSTEM/manager as SYSDBA" I get the following error.

ORA-01017: invalid user/password; logon denied;

Below, I have attached the simple program I wrote:


------------------------------------------------
#include <iostream>

using namespace std;

#include <stdio.h>

// Compile OTL 4.0 for OCI9
#define OTL_ORA9I
#define OTL_EXCEPTION_STM_TEXT_SIZE 4096
#include <otlv4.h>

otl_connect db;

int main()
{
// Initialise the OCI enviroment
otl_connect::otl_initialize();

try
{
cout << "--- Executing the rlogon ---" << endl;
// Connect to Oracle to user SYSTEM
db.rlogon("SYS/parc123 as SYSDBA");
cout << "Done" << endl;

cout << "--- Executing the drop table ---" << endl;
// Drop the table created in the previous run
otl_cursor::direct_exec(db, "drop table test_tab", otl_exception::disabled);

cout << "--- Executing the create table ---" << endl;
// Create the table test
otl_cursor::direct_exec(db,
"create table test_tab (num1 NUMBER(10), longnum1 NUMBER(20), longnum2 NUMBER(20), shortnum NUMBER(4), binfield BLOB, PRIMARY KEY(longnum1,num1,shortnum))");

}
catch(otl_exception& p)
{
cerr << "Oracle Error Message : " << p.msg << endl;
cerr << "SQL Statement executed: " << p.stm_text << endl;
cerr << "Oracle Variable Info : " << p.var_info << endl;
cerr << "Exception Code : " << p.code << endl;
}

// Disconnect from Oracle
db.logoff();

return 0;
}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 10 2009
Added on Apr 27 2006
2 comments
12,650 views