Reputation: 307
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 ^^
Upvotes: 1
Views: 1598
Reputation: 91
Use displayText() for getting detailed exception message:
catch(Poco::Data::MySQL::MySQLException& e)
{
std::cout << "Error: " << e.displayText() << '\n';
}
Upvotes: 1
Reputation: 307
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.
Upvotes: 0