#include #include using namespace oracle::occi; using namespace std; int main (void) { //Environment und Connection erzeugen Environment* env = Environment::createEnvironment(); Connection* conn = env->createConnection( "scott", "tiger" , "cornel" ); cout << "Environment und Connection erzeugt" << endl; //SQL-Statement erzeugen Statement* stmt = conn->createStatement(); cout << "Statement erzeugt" << endl; //DML: INSERT try { stmt->setSQL("INSERT INTO dept (deptno, dname, loc) \ VALUES (80,'SALES EMEA','FRANKFURT')"); stmt->executeUpdate(); cout << "Record inserted" << endl; } catch(SQLException ex) // Oracle-Exceptions abfangen { //Fehler-Nummer cout << "Error number: " << ex.getErrorCode() << endl; //Vollstaendige Oracle-Fehlermeldung (Nr.+Text) cout << ex.getMessage() << endl; } conn->terminateStatement(stmt); cout << "Statement beendet" << endl; //Environment und Connection beenden env->terminateConnection(conn); Environment::terminateEnvironment(env); cout << "Environment und Connection beendet" << endl; }