MySQL Forums
Forum List  »  Connector/C++

The driver crash when calling driver->connect
Posted by: Laurent Duroisin
Date: November 27, 2020 03:06PM

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.

Options: ReplyQuote


Subject
Views
Written By
Posted
The driver crash when calling driver->connect
155
November 27, 2020 03:06PM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.