The easiest way is the use Oaracle's ProC. I have included a file that will attach to an oracle database using ProC.
/*----------------------------------------------------------------*/
// Name: TestProC.pc
// Date: 7/24/01
//
// Description: This application is a simple Oracle SQL shell that
// can be used to test various SQL statements.
//
/*----------------------------------------------------------------*/
#include <iostream.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
/*----------------------------------------------------------------*/
// This section is used to define variables that will be used by
// Oracle
/*----------------------------------------------------------------*/
EXEC SQL begin declare section;
varchar user[20];
varchar pass[20];
long oats_roe_id;
EXEC SQL end declare section;
#include <sqlca.h>
/*----------------------------------------------------------------*/
// Procedure delarations
/*----------------------------------------------------------------*/
void sql_error (char *msg);
int main() {
long t1;
long t2;
/*----------------------------------------------------------------*/
// Get user's Oracle username and password and open a session
/*----------------------------------------------------------------*/
printf("Enter your USERID: "

;
scanf("%s",user.arr);
user.len = strlen((const char *)user.arr);
system("stty -echo"

;
printf("Enter your PASSWORD: "

;
scanf("%s",pass.arr);
pass.len = strlen((const char *)pass.arr);
system("stty echo"

;
printf("\n"

;
/*----------------------------------------------------------------*/
// execute sql_error function when Oracle returns an error
/*----------------------------------------------------------------*/
EXEC SQL whenever sqlerror do sql_error("Oracle error:"

;
/*----------------------------------------------------------------*/
// Connect to database
/*----------------------------------------------------------------*/
EXEC SQL connect :user identified by

ass;
cout << "\nConnected to ORACLE as user: "
<< (char *)user.arr << endl << endl;
/*----------------------------------------------------------------*/
// Build Oracle SQL statement here. Be sure to precede the statement
// with EXEC SQL. Be sure to check for errors before proceeding
// (sqlca.sqlcode...)
/*----------------------------------------------------------------*/
t1 = clock();
EXEC SQL select new_order.oats_roe_id
into

ats_roe_id
from new_order
where new_order.oats_roe_id = 157680;
t2 = clock();
if (sqlca.sqlcode == 0)
cout << "oats_roe_id returned: " << oats_roe_id << endl;
else
cout << "Error: " << sqlca.sqlerrm.sqlerrmc << endl;
cout << "Time to process SQL statement: " << t2-t1 << " sec" << endl;
/*----------------------------------------------------------------*/
// Close connection
/*----------------------------------------------------------------*/
EXEC SQL commit work release;
exit(0);
}
/*----------------------------------------------------------------*/
// Display Oracle error
/*----------------------------------------------------------------*/
void sql_error(char *msg) {
cout << endl << msg << endl;
sqlca.sqlerrm.sqlerrmc[sqlca.sqlerrm.sqlerrml] = '\0';
cout << sqlca.sqlerrm.sqlerrmc << endl;
exec sql whenever sqlerror continue;
exec sql rollback release;
exit(1);
}