Method To Make Mysql Work With Visual C
Method To Make Mysql Work With Visual C
#include "stdafx.h"
#include <stdlib.h>
#include <iostream>
#include "mysql_connection.h"
#include "mysql_driver.h"
#include <cppconn/driver.h>
#include <cppconn/exception.h>
#include <cppconn/resultset.h>
#include <cppconn/statement.h>
Unlike what the mysql tutorial claims to declare the driver with the Driver class, like so:
sql::Driver *driver;
sql::mysql::MySQL_Driver *driver;
The tutorial also says to get an instance of the driver with the get_mysql_driver_instance() method.
Something required in JDBC, but it appears to not be required here. Instead i connected directly to
the database with the necessary credentials usin the connect() method. So the
get_mysql_driver_instance() method does not get resolved by the linker (although the program
compiles fine).
http://msdn.microsoft.com/en-us/library/ec7sfckb%28VS.80%29.aspx
http://dev.mysql.com/doc/refman/5.1/en/connector-cpp-apps-windows-visual-studio.html
http://stackoverflow.com/questions/2128995/lnk2001-error-when-compiling-windows-forms-
application-with-vc-2008
http://forge.mysql.com/wiki/Connector_C%2B%2B#Getting_Started:_Usage_Examples