Menu

#5 Help about OTL

open
nobody
None
5
2006-04-27
2006-04-27
Anonymous
No

I am using the C++ OTL library to create an Oracle 9i
client application.

Before to start to design my client application, I
wanted to get a bit familiar with OTL, that I have to
say is really easy to use. My main problem at the
moment is the client connection.

Using the sqlplus, 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:

If you have any idea what I am doing wrong, I would
really appreciate your help.

Best Regards

Stefano

PS: The Oracle 9i I am using, it is for OS Solaris 8
and version 9.2.0.4.

My example program:
------------------------------------------------
#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("SYSTEM/manager 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;
}

======================================

Output running the client:

--- Executing the rlogon ---
Oracle Error Message : ORA-01017: invalid
username/password; logon denied

SQL Statement executed:
Oracle Variable Info :
Exception Code : 1017

-------------------------------------
Following, it is the Oracle enviroment:
ORACLE_BASE=/export/home/oracleSoftware
ORACLE_DOC=/export/home/oracleSoftware
ORACLE_HOME=/export/home/oracleSoftware/product/9.2.0.
4
ORACLE_SID=PARC
ORA_PARC_DB=/export/home/oracleDB

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.