I Build my simple project in MSVC19, and I can't this code work.
#include "iostream"
#include "occi.h"
using namespace std;
using namespace oracle::occi;
#define db_user_name "test"
#define db_password "test"
#define db_conn_str "service"
int main(int argc, char* argv[])
{
try
{
Environment* env = Environment::createEnvironment(Environment::OBJECT); // in line with error => goto catch block and return 32104
Connection* conn = env->createConnection(db_user_name, db_password, db_conn_str);
Statement* stmt = conn->createStatement("Select 1 from dual");
ResultSet* rs = stmt->executeQuery();
int res = 0;
while (rs->next())
{
res = rs->getInt(1);
}
stmt->closeResultSet(rs);
env->terminateConnection(conn);
Environment::terminateEnvironment(env);
}
catch (SQLException & sqlExcp)
{
std::string temp = sqlExcp.getMessage();
std::cerr << sqlExcp.getErrorCode() << " " << sqlExcp.getMessage() << std::endl;
}
system("pause");
return 0;
}