MySQL Forums
Forum List  »  Connector/C++

Exit clean up when use "sql::Connection" after network disabled.
Posted by: WONJIN CHOI
Date: August 04, 2016 06:11PM

Hello ^^

I'm new on using mysql_cpp_conn with c++ and having a problem.

below is my testing code,

sql::Connection * _con;
sql::Statement * _stmt;


try {
if (false == _con->isValid()){ // ----------- A
return false;
_pstmt = _con->prepareStatement(string); // ------------ B
}catch (sql::SQLException &e) {
manageException(e); // ------------ C
return false;
this works well in normal situation. but in my testing scenarios this code
exit clean up. no throwing exceptions.

[ my scenario ]

1. procses start~

2. breaking points at code [A, b, C]

3. run code [A] -> it's ok

3. disable ethernet adaptor! it's simulation for ethernet-adaptor's hardware faults.

4. run code B -> exit clean up. process terminated. no exceptions.

* in case unpluged rj45 cable, it's throw SQLException. but in case disabled ethernet adaptor, it's just exit process.

it's ok function's failed but i want to keep running my process not exit.


Options: ReplyQuote

Written By
Exit clean up when use "sql::Connection" after network disabled.
August 04, 2016 06:11PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.