Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

About Environment::createConnection

User_P7MQ1Dec 17 2020 — edited Dec 18 2020

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.)

Comments

Post Details

Added on Dec 17 2020
2 comments
156 views