Forum Stats

  • 3,770,743 Users
  • 2,253,162 Discussions
  • 7,875,573 Comments

Discussions

About Environment::createConnection

User_P7MQ1
User_P7MQ1 Member Posts: 3
edited Dec 18, 2020 7:40AM in Oracle Call Interface (OCI)

I want to know if I enter an incorrect parameter on createConnection, what value will it return to me? The situation I encountered was in


try{

Environment *env;

Connection *conn;

char *usrName = "123";//A deliberately incorrect value

char* usrPwd="123";//A deliberately incorrect value

char* connectStr="123:1521/ ";//A deliberately incorrect value

env = Environment::createEnvironment();

conn = env->createConnection(usrName,usrPwd,connectStr);

}


catch(SQLException p){


cout<<"ErrorCode:"<


cout<<"ErrorMsg:"<


return -1;


}


It will output error code and error message, but instead of return, it will enter interrupt error, indicating heap corruption. So the question is, how do I handle the error after I enter the wrong parameters (account, password, port, etc.)

Answers

  • Timo Hahn
    Timo Hahn Senior Principal Technical Consultant - Oracle ACE Director Member, Moderator Posts: 37,675 Red Diamond

    User, can you tell us which product your question is about, please?

    The community is product-related. Once we know the product you are using, we'll find the right forum for your question.


    Timo

  • I'm currently using Oracle 11gR2, and The main thing I want to know is if I'm using the OCCI interface function and the user enters the wrong password (which they certainly will), then I need to know how To handle the error if I enter the wrong password at createconnection(). In the official documentation, I don't see a return value or anything like that. In addition, you now have a situation where you enter the wrong parameter and an immediate interrupt error occurs in the VS2008 environment, indicating heap corruption. Can someone tell me what to do?