occi连接oracle数据库出现错误

在vs2015中用occi连接oracle数据库时,程序能运行,但不久就会显示程序已停止运行
以下是我的代码:
#include

#include
using namespace std;
using namespace oracle::occi;

int main()
{
Environment *env;
Connection *conn;
Statement *stmt;
ResultSet *rt;
string username = "system";
string code = "123Tanruifeng";
string dataID = "orcl2";
env = Environment::createEnvironment();
conn = env->createConnection(username, code,dataID);
stmt = conn->createStatement();
stmt->executeUpdate("insert into department(dno,dname) values('d004','数学')");
rt = stmt->executeQuery("select * from department");
while (rt->next())
{
string fruit = rt->getString(1);
int qua = rt->getInt(2);
cout << qua << " " << fruit << endl;
}
conn->terminateStatement(stmt);
env->terminateConnection(conn);
Environment::terminateEnvironment(env);

}

出现的错误
图片说明

请各位大神帮帮忙!!!

查看全部
qq_38891425
qq_38891425
2017/06/10 06:23
  • oracle
  • occi
  • 点赞
  • 收藏
  • 回答
    私信

0个回复