简体   繁体   中英

C++ connecting VS to Oracle

#include<iostream>
#include<iomanip>
#include<occi.h>
#include<string>
using namespace std;
using namespace oracle::occi;
int main (void){
    string utilizador ="B3_1";
    string password ="B3_1";
    string bd ="gandalf.dei.isep.ipp.pt:1521/pdborcl";
    try{
        Environment *env;
        Connection *ligacao;
        Statement *instrucao;
        env = Environment::createEnvironment (Environment::DEFAULT);
        ligacao = env->createConnection (utilizador, password, bd);
        cout <<"BDdad: a ligar ..."<< endl;

    }catch(SQLException erro){
        cerr <<"Erro: "<< erro.getMessage () << endl;}
    cin.get();
    return 0;
}

For this college project I need to connect Visual Studio 2012 to Oracle in order to interact with the database through VS. The problem is, all my workgroup can connect without any errors but in my case it's slightly different. I get a SQL Exeception in the line "env = Environment::createEnvironment (Environment::DEFAULT);" . The error code is 1804, and the message it displays is "error while trying to retrieve text for error ORA-01804" . I thought it could be the paths but I have the same as my friends and they can connect and I don't. Have this ever happened or is it normal ?

EDIT: My teacher advised me to change the version of the Visual Studio 2012. I had the Ultimate version and he told to use the Express to see if works. Already did that and the result is the same. I looked all over the internet and couldn't find a straight answer to my problem.

Error code #32104 indicates that an error occurred in the call but the actual error message could not be retrieved. Essentially this means that Environment::createEnvironment failed then tried to acquire message associated with the error. When it couldn't find it the 32104 error was returned instead.

Because of this the exact cause of the error may be difficult to determine. I do suggest that you ensure both ORACLE_HOME and ORACLE_SID are defined in your shell environment.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM