ITPub博客

首页 > 数据库 > Oracle > 如何在linux下面配置OCCI 2

如何在linux下面配置OCCI 2

原创 Oracle 作者:wzy25 时间:2019-06-30 09:39:06 0 删除 编辑
测试用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博客 ” ,链接:http://blog.itpub.net/3618/viewspace-1032893/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2001-12-14

  • 博文量
    1011
  • 访问量
    763081