terminate called after throwing an instance of 'otl_tmpl_exception<otl_exc, otl_conn, otl_cur>`解决方法

来源:互联网 发布:矩阵与向量运算法则 编辑:程序博客网 时间:2024/04/29 20:12

在linux下用c++连接MySQL或oracle数据库时,若频繁调用otlstream构造函数,发生 terminate called after throwing an instance of 'otl_tmpl_exception<otl_exc, otl_conn, otl_cur>`的问题,其解决方法为:

在调用otl_connect类的void rlogon(const char* connect_str, const int aauto_commit=0)函数时,将aauto_commit的值置为1。

示例代码:
db.rlogon("DSN=my_db;UID=sa;PWD=tiger",1);
其中db为otl_connect类的对象。

注意:第二参数aauto_commit设置为1,表示数据库事务自动提交;设置为0,表示数据库事务非自动提交。
0 0