大家帮忙看一下 C++用OCCI连接 Oracle 报错
用C++ .NET 2008 用OCCI连接Oracle 时候出的问题报这个错误控制台.exe 中的 0x7c812afb 处未处理的异常: Microsoft C++ 异常: 内存位置 0x0012fb88 处的 oracle::occi::SQLException。
代码如下
#include "stdafx.h"
#include<string>
#include<iostream>
#pragma comment (lib,"oraocci10.lib")
#include "occi.h"
using namespace std;
using namespace oracle::occi;
int main()
{
Environment *env;
Connection *conn;
Statement *stmt;
//连接
string struser("system");
string strpwd("sa");
string strconn_string("192.168.1.105:1521/bee");
env = Environment::createEnvironment(Environment::OBJECT);
conn = env->createConnection(struser,strpwd,strconn_string);
if( NULL != conn )
cout<<"conn success"<<endl;
else
cout<<"conn failed"<<endl;
//执行sql,返回结果并显示
string strsql("select * from test");
stmt = conn->createStatement(strsql);
ResultSet *rset = stmt-> executeQuery();
while(rset->next())
{
int id = rset->getInt(1);
string strname = rset->getString(2);
cout<<"id=="<<id<<"name=="<<strname<<endl;
}
//关闭
stmt->closeResultSet(rset);
conn->terminateStatement(stmt);
env->terminateConnection(conn);
Environment::terminateEnvironment(env);
return 0;
}
--------------------编程问答-------------------- 就是这段代码的问题
conn = env->createConnection(struser,strpwd,strconn_string);
应该怎么处理? --------------------编程问答-------------------- --------------------编程问答-------------------- 同上问题,求大神~~~~~~~~~~~~~~~~
补充:.NET技术 , VC.NET