I am writing a simple program in Eclipse CDT to connect to a MySQL Server hosted locally. I have ensured the server is running. The code I am trying to execute is the following:
driver = get_driver_instance();
connection = driver->connect("tcp://127.0.0.1:3306","DBServer","root"); /*Where the program crashes*/
statement = connection->createStatement();
The include statements are:
The program crashes on running. While debugging I can see that the crash occurs while trying to establish the connection to the server. I have ensured that all required libraries have been added along with the required include files (I have images for the same but am unable to add them here). I am not sure what is it that I am doing wrong.
One of my doubts is the get_driver_instance()
function used might from a different library, but adding sql::
or even sql::mysql::
in front of it gives undefined reference errors, even though the libraries have been added.
Here are items that have been included:
1. "C:\Program Files\MySQL\MySQL Server 5.6\include"
2. "C:\Program Files\MySQL\Connector.C++ 1.1\include"
1. "C:\Program Files\MySQL\Connector.C++ 1.1\include\mysql_connection.h" (added manually as there was an issue with the compiler finding it)
1. "C:\Program Files\MySQL\MySQL Server 5.6\lib"
2. "C:\Program Files\MySQL\Connector.C++ 1.1\lib\opt"
Miscellaneous ( as they don't follow GCC naming conventions)
1. "C:\Program Files\MySQL\Connector.C++ 1.1\lib\opt\mysqlcppconn-static.lib"
2. "C:\Program Files\MySQL\Connector.C++ 1.1\lib\opt\mysqlcppconn.dll"
3. "C:\Program Files\MySQL\MySQL Server 5.6\lib\mysqlclient.lib"
4. "C:\Program Files\MySQL\MySQL Server 5.6\lib\libmysql.lib"