我的Oracle版本是11.1.0.6,
vs版本是2005用的oracle occi库是oracle 安装后OCI文件夹中自带的vc8库
#include "occi.h"
using namespace oracle::occi;#include <iostream>using namespace std;
int main()
{
Environment* pEnv=Environment::createEnvironment(Environment::OBJECT);
if (!pEnv)
{
cout<<"failed to create oracle environment..."<<endl;
return 0;
}
else
cout<<" create oracle environment..."<<endl; Connection* pCon=pEnv->createConnection("sys","sys","oradb"); //在这个地方报内存异常 if (!pCon)
{
cout<<"failed to create oracle connection..."<<endl;
Environment::terminateEnvironment(pEnv);
pEnv=0;
return 0;
}
else
cout<<" create oracle connection..."<<endl;
pEnv->terminateConnection(pCon);
Environment::terminateEnvironment(pEnv);
pCon=0;
pEnv=0;
return 0;
}查了很多资料,始终没有解决,内存异常任然报
vs版本是2005用的oracle occi库是oracle 安装后OCI文件夹中自带的vc8库
#include "occi.h"
using namespace oracle::occi;#include <iostream>using namespace std;
int main()
{
Environment* pEnv=Environment::createEnvironment(Environment::OBJECT);
if (!pEnv)
{
cout<<"failed to create oracle environment..."<<endl;
return 0;
}
else
cout<<" create oracle environment..."<<endl; Connection* pCon=pEnv->createConnection("sys","sys","oradb"); //在这个地方报内存异常 if (!pCon)
{
cout<<"failed to create oracle connection..."<<endl;
Environment::terminateEnvironment(pEnv);
pEnv=0;
return 0;
}
else
cout<<" create oracle connection..."<<endl;
pEnv->terminateConnection(pCon);
Environment::terminateEnvironment(pEnv);
pCon=0;
pEnv=0;
return 0;
}查了很多资料,始终没有解决,内存异常任然报
至少,你得
catch (SQLException e) {
....
捕获一下异常。
另外,不推荐使用sys用户作为连接用户。
createEnnironment直接不带参数,或者使用Environment::Default即可,你用OBJECT做什么?使用了oracle数据库中 的对象类型?