Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Oracle DB Connectivity through OCI and C++

Oracle DB Connectivity through OCI and C++

From: Darren Greer <drgreer_at_qtiworld.com>
Date: Tue, 18 May 1999 23:01:13 GMT
Message-ID: <3741f0fc.1653357582@news.qgraph.com>


Sorry for the re-post. I forgot the subject on the last post.

Hello all.

We are trying to implement some C++ programs using OCI to access an Oracle Database. However we are having trouble during the linking stage. Before I ask for too much help, I would just like some suggestions as to which libraries the following are in. Below is posted the output of the compilation/linking of our program.

Below the Errors is our C++ code.

If anyone has had any luck working with OCI, and/or gcc/g++ I would appreciate any insight you may be able to through our way.

Thanks,

Darren

--------------Errors-----------------
bart:/users/drgreer/c/oracle =>make -f oracle.mk test1 
        /opt/gcc/bin/g++ -O test1.cc -L/usr/oracle/7.3.4/lib
-L/usr/oracle/7.3.4/rdbms/lib -o test1
collect2: ld returned 1 exit status
/usr/ccs/bin/ld: Unsatisfied symbols:

   oerhms (code)
   obndra (code)
   oopen (code)

   oparse (code)
   obndrv (code)
   ologof (code)

   ofen (code)
   odefin (code)
   odescr (code)
   ocom (code)
   olog (code)
   oclose (code)
   oexn (code)
*** Error exit code 1

Stop.

#include <iostream.h>
#include <stdio.h>
#include <otl7.h>

otl_connect db;

void select() {

char f1[256];

        otl_stream oraclestream (256
// buffer size

                                ,"select * from v$database"

//select sql statement
,db);

// connect object

        cout << endl;

        while (!oraclestream.eof()){
                oraclestream>>f1;
                cout<<"f1="<<f1<<endl;
        }
        cout << endl;

}

//---------------------------------------------

int main() {

        otl_connect::otl_initialize();
// init OCI environment

        try {
                db.rlogon("login/password");

// connect to oracle
                select();
        }

        catch(otl_exception& p) {

// intercept OTL exceptions
cerr<<p.msg<<endl; if (p.stm_text) cerr<<p.stm_text<<endl;
// print offending sql
} db.logoff(); return 0;

} Received on Tue May 18 1999 - 18:01:13 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US