Archived

This forum has been archived. Please start a new discussion on GitHub.

cannot debug oracle occi + ICE in VS2010

hi, I download the oracle occi demo program as follow:

/**
* occiproc - Demonstrating the invoking of a PL/SQL function and procedure
* using OCCI.
*
* DESCRIPTION :
* This program demonstrates the invoking a PL/SQL function and procedure
* having IN, IN/OUT and OUT parameters.
*
*/
#include <occi.h>
#include <iostream>
using namespace oracle::occi;
using namespace std;

class occiproc
{
private:

Environment *env;
Connection *con;
StatelessConnectionPool* pool;

public :
/**
* Constructor for the occiproc demo program.
*/
occiproc (string user, string passwd, string db) throw (SQLException)
{
env = Environment::createEnvironment (Environment::DEFAULT);
pool = env->createStatelessConnectionPool(user, passwd, db, 10, 5, 1, StatelessConnectionPool::HOMOGENEOUS);
con = env->createConnection (user, passwd, db);
}// end of constructor occiproc (string, string, string )

/**
* Destructor for the occiproc demo program.
*/
~occiproc () throw (SQLException)
{
env->terminateConnection (con);
Environment::terminateEnvironment (env);
} // end of ~occiproc ()

// Function to call a PL/SQL procedure
void callproc ()
{
cout << "callproc - invoking a PL/SQL procedure having IN, OUT and IN/OUT ";
cout << "parameters" << endl;
Statement *stmt = con->createStatement
("BEGIN demo_proc(:v1, :v2, :v3); END;");
cout << "Executing the block :" << stmt->getSQL() << endl;
stmt->setInt (1, 10);
stmt->setString (2, "IN");
stmt->registerOutParam (2, OCCISTRING, 30, "");
stmt->registerOutParam (3, OCCISTRING, 30, "");
int updateCount = stmt->executeUpdate ();
cout << "Update Count:" << updateCount << endl;

string c1 = stmt->getString (2);
string c2 = stmt->getString (3);
cout << "Printing the INOUT & OUT parameters:" << endl;
cout << "Col2:" << c1 << " Col3:" << c2 << endl;

con->terminateStatement (stmt);
cout << "occiproc - done" << endl;
} // end of callproc ()

// Function to call a PL/SQL function
void callfun ()
{ cout << "callfun - invoking a PL/SQL function having IN, OUT and IN/OUT ";
cout << "parameters" << endl;
Statement *stmt = con->createStatement
("BEGIN :a := demo_fun(:v1, :v2, :v3); END;");
cout << "Executing the block :" << stmt->getSQL() << endl;
stmt->setInt (2, 10);
stmt->setString (3, "IN");
stmt->registerOutParam (1, OCCISTRING, 30, "");
stmt->registerOutParam (3, OCCISTRING, 30, "");
stmt->registerOutParam (4, OCCISTRING, 30, "");
int updateCount = stmt->executeUpdate ();
cout << "Update Count : " << updateCount << endl;

string c1 = stmt->getString (1);
string c2 = stmt->getString (3);
string c3 = stmt->getString (4);

cout << "Printing the INOUT & OUT parameters :" << endl;
cout << "Col2:" << c2 << " Col3:" << c3 << endl;
cout << "Printing the return value of the function :";
cout << c1 << endl;

con->terminateStatement (stmt);
cout << "occifun - done" << endl;
} // end of callfun ()
}; // end of class occiproc

int main (void)
{
string user = "USFAMP";
string passwd = "PSFAMP";
string db = "jhtech";

cout << "occiproc - invoking a PL/SQL function and procedure having ";
cout << "parameters" << endl;

occiproc *demo = new occiproc (user, passwd, db);
demo->callproc();
delete demo;

}// end of main ()


when I debug it in VS2010, everything is ok!(oracle 11.2 occi 11.2 oci 11.2)!

but when I only add the include file and link the ICE lib.
#include <Ice/Ice.h>
....

and link the oraocci11d.lib oci.lib iced.libiceutild.lib
when I debug it in VS2010 IDE, only in
env = Environment::createEnvironment (Environment::DEFAULT);
exception will happened!!!!!

why? thanks!

Comments