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 -> Re: Problem with OCCI, g++ and catching exceptions

Re: Problem with OCCI, g++ and catching exceptions

From: Johannes Lochmann <johannes.lochmann_at_chello.at>
Date: Tue, 30 Apr 2002 17:50:42 GMT
Message-ID: <slrnactpvd.t37.work@linux.local>


Billy O'Connor schrieb im Artikel <m37kmpgr9s.fsf_at_dpscon.com>:

>> 

> Johannes,
> If you can you post the smallest example of code that will compile and
> produce the error, it would be easier to help track down the problem.
 

Here is a minimal working code snippet. If you run it once, it works fine and inserts 'Hello' into t.t. Second run aborts the program because of the violated PRIMARY KEY constraint.

You probably have to change user (SCOTT) and pass (TIGER) in the source.

Compiler is g++ 2.95.3. The command is:

g++ -I$ORACLE_HOME/rdbms/demo -I$ORACLE_HOME/plsql/public \ -I$ORACLE_HOME/rdbms/public -I$ORACLE_HOME/network/public \ -L$ORACLE_HOME/lib -locci -lclntsh -o minimal minimal.cc

Using g++ 3.0.4 gives the follwing error:

In file included from $ORACLE_HOME/rdbms/demo/occiData.h:74,

                 from $ORACLE_HOME/rdbms/demo/occi.h:40,
                 from minimal.cc:18:

$ORACLE_HOME/rdbms/demo/occiControl.h:572: looser throw specifier

   for `virtual oracle::occi::SQLException::~SQLException()' /opt/gcc304/include/g++-v3/exception:53: overriding `virtual

   std::exception::~exception() throw ()'

I understand, that the destructor from std is beeing overridden, but what is meant by "looser throw specifier"?

If you need more information please tell me, I would be happy to provide it.

Thank you

Johannes Lochmann

Here is the code snippet:

/*
Short sample for bug tracking purpose. The following table must exist in an oracle database:

CREATE TABLE t(

	t	VARCHAR(16),
	CONSTRAINT	pk_t PRIMARY KEY(t)

);

the user specified below must have insert priv to this table and be able to connect with the given password, obviously.

This sample can be built with the following command:

g++ -I$ORACLE_HOME/rdbms/demo -I$ORACLE_HOME/plsql/public \ -I$ORACLE_HOME/rdbms/public -I$ORACLE_HOME/network/public \ -L$ORACLE_HOME/lib -locci -lclntsh -o minimal minimal.cc

Compiler is g++ 2.95.3.
*/

#include <occi.h>
#include <iostream.h>

using namespace oracle::occi;
using namespace std;

const string user = "emsdevel";
const string pass = "emsdevel";

int main(int argc, char** argv){

	Environment *env = Environment::createEnvironment();
	Connection *conn = env->createConnection(user, pass);
	Statement *stmt = conn->createStatement();
	
        try {
		string qs = "INSERT INTO t(t) VALUES('Hello')";
                stmt->setSQL(qs);
		
		stmt->executeUpdate();
		
		conn->commit();
        } catch (SQLException excp) {
                cout << endl << "Exception catched: " << excp.what() << endl;
        }

} Received on Tue Apr 30 2002 - 12:50:42 CDT

Original text of this message

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