I use this instruction:
https://dev.mysql.com/doc/connector-cpp/en/connector-cpp-apps-windows-visual-studio.html
I made each listed point.
But still have an error:
LNK2001 unresolved external symbol _get_driver_instance
Could you please give me an advice, how to solve it?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
#include <stdlib.h>
#include <iostream>
#include "mysql_connection.h"
#include <cppconn/driver.h>
#include <cppconn/exeption.h>
#include <cppconn/resultset.h>
#include <cppconn/statement.h>
using namespace std;
int main(void)
{
sql::Driver *driver;
sql::Connection *con;
sql::Statement *stmt;
//Create a connection:
driver = get_driver_instanve();
con = driver->connect("tcp://127.0.0.1:3306", "root", "password");
// Connect to the MySQL test database
con->setSchema("test");
stmt = con->createStatement();
stmt ->execute("USE test");
stmt ->execute("DROP TABLE IF EXISTS test");
stmt ->execute("CREATE TABLE test(id INT, label CHAR(1))");
stmt ->execute("INSERT INTO test(id, label) VALUES (1, 'a')");
delete stmt;
delete con;
}
|
Last edited on
Thank you very much Hippogriff.
I am still trying to connect it but it is already better.
Thanks a lot for your links.
Last edited on
So, how did I fix it:
1. installed 32x connector instead of 64 on a 64 mashine.
2. installed everything on another windows, everything from 0 and now it works well.
Thanks a lot for the support.