Question

I'm using Poco (1.5.2 ver) on C++, on Ubuntu (12.04), with MySQL 5.5 x64.

I try to connect to MySQL with this code:

#include <iostream>

#include <Poco/Data/MySQL/MySQLException.h>
#include <Poco/Data/MySQL/Connector.h>
#include <Poco/Data/SessionFactory.h>

using namespace std;

int main()
{
    Poco::Data::MySQL::Connector::registerConnector();
    try
    {
        string chaine = "host=localhost;user=root;password=mypassword;";
        Poco::Data::Session test(Poco::Data::SessionFactory::instance().create(Poco::Data::MySQL::Connector::KEY, chaine));
    }
    catch(Poco::Data::MySQL::MySQLException& e)
    {
        cout << "Error: " << e.what() << endl;
    }
    return 0;
}

But there is a MySQLException:

Error: MySQL

What does it mean ? Is there anyone who can help me ?

Thank you !!

EDIT : ok the bug was a bad library link :p i used a lib which came from a bad MySQL version ^^

Was it helpful?

Solution 2

As I said in my first message, the bug was a bad library link. i used a lib which came from a bad MySQL version ^^

I hope this post will help guys who got the same problem.

OTHER TIPS

Use displayText() for getting detailed exception message:

catch(Poco::Data::MySQL::MySQLException& e)
{
    std::cout << "Error: " << e.displayText() << '\n';
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top