[Cppcms-users] cppDB - ERROR: cppdb::driver failed to load driver mysql - no module found
Brought to you by:
artyom-beilis
From: Daniel R. <dan...@li...> - 2011-08-10 23:56:19
|
Hello there!, Im trying to run a simple example of cppDB with mysql. First cppDB installation was a PITA because the"mysql_client library was not found, disabling mysql backend, " cmake message.Since I'm a newbie in the GNU development, I've had to use saint google to found the solution..and that was install mysql development libraries. Anyway here's the source code I tried to run without success #include <cppdb/frontend.h>#include <iostream>#include <ctime> int main(){ try { cppdb::session sql("mysql:user=root;password=danielito;opt_reconnect=1;opt_read_timeout=10;opt_compress=1"); time_t now_time = std::time(0); std::tm now = *std::localtime(&now_time); cppdb::result res = sql << "SELECT id_enviroment, env_type, name FROM db_enviroment"; while(res.next()) { double f=-1; int id,k; std::tm atime; std::string name; //res >> id >> k >> f >> atime >> name; res >> id >> k >> name; std::cout <<id << ' '<<k <<' '<<name << std::endl; } } catch(std::exception const &e) { std::cerr << "ERROR: " << e.what() << std::endl; return 1; } return 0;} Compilation with: g++ dbtest.cpp -lcppdb -o dbtest Run with./dbtestERROR: cppdb::driver failed to load driver mysql - no module found Im doing it right ? Thanks ! |