Connector to mySQL database using Visual C++ 6.0 & mySQL Connector -
03-14-2011
, 04:55 PM
Hi,
I've set up an SQL database named "REMS" with multiple tables therein.
I've used a local client program called RazorSQL to connect to the
database with no problems.
I've written Visual C++ console program to connect and query the
database but ended getting a "Kernel32.dll 0xE06D7363: Microsoft C++
Exception" error the last line of the following code executes:
#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"
sql::mysql::MySQL_Driver *driver;
sql::Connection *con;
sql::Statement *stmt;
sql::ResultSet *res;
driver = sql::mysql::get_mysql_driver_instance();
con = driver->connect("localhost:3306", "root", "password");
stmt = con->createStatement();
stmt->execute("Use REMS"); //THIS LINE GIVES "Kernel32.dll
0xE06D7363: Microsoft C++ Exception" error
Any advice would be greatly appreciated. Thanks in advance! |