| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.misc -> Problem with OCCI, g++ and catching exceptions
Hello,
I have encountered a problem while using OCCI (Oracle C++ Call Interface) I was not able to solve. I hope someone here can give me a hint how I could further track down the issue.
I have a table:
CREATE TABLE t(
t VARCHAR(32), CONSTRAINT pk_t PRIMARY KEY(t);
I have a Class OInterface:
OInterface{
public:
OInterface(); ~OInterface();
OInterface::OInterface(){
Environment *env = Environment::createEnvironment();
Connection conn = penv->createConnection("SCOTT", "TIGER");
Statement statement = conn->createStatement();
string str = "INSERT INTO t(t) VALUES(:t)";
try {
statement->setSQL(str);
statement->setString(1, "Hello");
statement->executeUpdate();
} catch (SQLException e) {
cout << endl << "Exception thrown: "
<< e.what() << endl;
}
OInterface::~OInterface(){
conn->terminateStatement(statement);
env->terminateConnection(conn);
Environment::terminateEnvironment(env);
The sample compiles fine and works fine until I violate the pk_t constraint of the table t.
As I understand the documentation, in this case an SQLException should be thrown which I should be able to catch with the above try{...} catch(...) {...} construction.
The problem is, the program crashes and no Exception can be catched by my code.
I tried the above code with Oracle 9i using g++ 2.95.3 and g++ 3.0.4 everytime with the same result.
Other exception using libraries work just fine, so I think that I am using OCCI somehow wrong, g++ has a bug here or OCCI has a bug.
Has anybody a clue what the problem could be?
Thank you for your time and help
Johannes Lochmann Received on Tue Apr 30 2002 - 09:43:00 CDT
![]() |
![]() |