简体   繁体   English

MySQL C ++连接器:SIGABRT连接到数据库

[英]MySQL C++ Connector: SIGABRT Connecting to Database

I am having a hard time getting past this bug. 我很难克服这个错误。 Recently, changed from VM of Ubuntu 14.04 to making Ubuntu 15.10 my host OS. 最近,从Ubuntu 14.04的VM更改为将Ubuntu 15.10用作主机OS。 Now I am having a myriad of issues with this project; 现在,我在这个项目中遇到许多问题。 this one being the most recent. 这是最新的。 I am getting a SIGABRT signal when executing the code that calls this function DB_Interface::DB_Interface(int Preset) . 在执行调用此函数DB_Interface::DB_Interface(int Preset)的代码时,我收到SIGABRT信号。 When this function is called from an executable, the error arises in the second try{}catch{} block. 当从可执行文件中调用此函数时,第二个try{}catch{}块中会出现错误。 So I don't think it something specific to SetSchema . 所以我不认为这是SetSchema

I have tried reinstalling all the mysql libraries and tools( HERE ). 我试过重新安装所有的mysql库和工具( HERE )。 I have checked accessing the server from the command prompt with the same credentials with no problem. 我已经检查了使用相同的凭据从命令提示符访问服务器,没有问题。 So I am leaning to incompatibility of the C++ connector with something... The million dollar question. 所以我倾向于C ++连接器与某些东西不兼容...百万美元的问题。 So my question is how to resolve this issue. 所以我的问题是如何解决这个问题。 More info below: 以下是更多信息:

System Info: 系统信息:

  • Ubuntu 15.10 Ubuntu 15.10
  • MySQL: Ver 14.14 Distrib 5.6.27 MySQL:版本14.14发行版5.6.27

Code Excerpt: 代码摘录:

DB_Interface::DB_Interface(int Preset) {

try{
    driver = sql::mysql::get_mysql_driver_instance();
    flags[0] = 0;
}
catch(...)
{
    flags[0] = 1;
    printf("DB_Interface: Flag 0 has been set.");
    throw Except;
}
try{
    con = driver->connect("localhost:3306", "CANS_OPERATION", "SMOOTH_OPERATOR");
    flags[1] = 0;
}
catch(...)
{
    flags[1] = 1;
    printf("DB_Interface: Flag 1 has been set.");
    throw Except;
}

try{
    con->setSchema("CANS_SQL"); //SIGABRT occurs in executing this line.
    std::string Query = "UNLOCK TABLES";
    sql::Statement *stmt;
    stmt = con->createStatement();
    stmt->execute(Query);
    flags[4] = 0;
}
catch(sql::SQLException &e)
{
    flags[4] = 1;
    printf("DB_Interface: Flag 4 has been set");
    throw Except;
}

EDIT 1 The following has also been attempted with no success. 编辑1以下尝试也没有成功。

sudo apt-get install cpp:i386 gcc:i386 g++-5:i386 gcc-5:i386 g++:i386 libboost-dev:i386 binutils:i386

Followed by a reinstall of libmysqlcppconn-dev. 随后重新安装libmysqlcppconn-dev。

For anyone that may have the same issue, this has been resolved. 对于可能存在相同问题的任何人,此问题已得到解决。 When I moved to Ubuntu 15.10, I used the same schema model as I did in my last setup. 当我移至Ubuntu 15.10时,我使用了与上次设置相同的架构模型。 After testing on a completely separate schema for a test project, I noticed no issues. 在针对测试项目使用完全独立的架构进行测试之后,我没有发现任何问题。 This gave me the hunch that recreating my schema in this version of MySQL and Ubuntu may alleviate some issues. 这使我直觉,在此版本的MySQL和Ubuntu中重新创建架构可以缓解某些问题。 Surprise, surprise it did. 惊奇,惊奇。 After that I recreated the user "CANS_OPERATION". 之后,我重新创建了用户“ CANS_OPERATION”。 My excerpt above then worked. 然后,我上面的摘录成功了。 To get the MATLAB wrapper to work with it as well, I changed from the recommended g++-4.7 compiler for mex functions to the most recent release. 为了使MATLAB包装器也可以使用它,我从推荐的用于mex函数的g ++-4.7编译器更改为最新版本。 Hope this finds someone well. 希望这能找到一个很好的人。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM