Quantcast
Channel: MySQL Forums - Connector/C++
Viewing all articles
Browse latest Browse all 527

The driver crash when calling driver->connect (2 replies)

$
0
0
Hi, I want to connect to a database using the cpp connector but the program crash when I'm trying to connect to the database :

sql::Driver* driver = get_driver_instance();
std::cout<<driver->getMajorVersion()<<","<<driver->getMinorVersion()<<std::endl<<"name : "<<driver->getName()<<std::endl;
if (driver == nullptr)
std::cout<<"failed to get driver"<<std::endl;
sql::Connection* con = driver->connect("tcp://127.0.0.1:3306", "root",password);
if (con == nullptr)
std::cout<<"failed to connect to database"<<std::endl;
con->setSchema("sorrok");

And the returning version is strange, version major is 0, version minor is 22 and name is empty.
And when I use sql::mysql::MySQL_Driver = sql::mysql::get_mysql_driver_instance I get an undefined reference error to sql::mysql::get_driver_instance.

Viewing all articles
Browse latest Browse all 527

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>