测试用occi程序[@more@]#include
#include
using namespace oracle::occi;
using namespace std;
int main()
{
Environment *env;
Connection *con;
try
{
env = Environment::createEnvironment (Environment::DEFAULT);
{
con = env->createConnection ("scott","tiger");
Statement *stmt = con->createStatement("SELECT ENAME FROM EMP WHERE EMPNO=7654");
ResultSet *rs=stmt->executeQuery();
rs->next();
string empname=rs->getString(1);
cout << "Employee 7654 is called " << empname << endl;
con->terminateStatement(stmt);
env->terminateConnection (con);
}
Environment::terminateEnvironment(env);
}
catch (SQLException e)
{
cout << "Exception thrown" < endl;
cout << "Error number: " < e.getErrorCode() < endl;
cout << e.getMessage() < endl;
}
return 0;
}
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/3618/viewspace-1032893/
,如需转载,请注明出处,否则将追究法律责任。