Skip to content

Instantly share code, notes, and snippets.

@larryzhao larryzhao/test.cpp
Created Sep 8, 2015

What would you like to do?
// MySQLTest.cpp : Defines the entry point for the console application.
#include "stdafx.h"
#include <iostream>
#include "mysql_connection.h"
#include "mysql_driver.h"
#include "cppconn\statement.h"
#include "cppconn\resultset.h"
using namespace sql;
using namespace std;
int main()
mysql::MySQL_Driver *driver;
Connection *conn;
Statement *stmt;
ResultSet *result;
driver = sql::mysql::get_mysql_driver_instance();
conn = driver->connect("tcp://", "root", "admin");
stmt = conn->createStatement();
result = stmt->executeQuery("SELECT 'Hello World!' AS _message");
string message = result->getString("_message");
delete result;
delete stmt;
delete conn;
return 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.