当我运行以下代码时:
try{
m_driver = get_driver_instance();
m_conn = m_driver->connect("tcp://ipaddress:3306","username","password");
m_conn->setSchema("mydatabase");
}catch (sql::SQLException e) {
std::cout << "# ERR: SQLException in " << __FILE__;
std::cout << "(" << __FUNCTION__ << ") on line " << __LINE__ << std::endl;
std::cout << "# ERR: " << e.what();
std::cout << " (MySQL error code: " << e.getErrorCode();
std::cout << ", SQLState: " << e.getSQLState() << " )" << std::endl;
}
我得到了输出:
terminate called after throwing an instance of 'sql::SQLException'
Abort trap: 6
而不是我的例外。怎么了?
注意:我正在使用启用了c ++ 11的g ++ 4.8.2编译器。