Steps:
- Installed Mysql Server 2005
- Downloaded Mysql++, built both debug and release version.
- Ran install.hta and selected a directory
- Added library/include directory in MSVC++ 2008
- Included mysql++.h in my application
- Moved .dll files (libMYSQL.dll and mysqlpp.dll and mysqlpp_d.dll) to Debug folder.
Relevant code:
#include "mysql++.h"
class Database {
private:
mysqlpp::Connection* conn;
public:
~Database();
bool Connect(char* ip, char* user, char* pass, char* db);
};
bool Database::Connect(char* ip, char* user, char* pass, char* db) {
conn = new mysqlpp::Connection(false);
return conn->connect(db, ip, user, pass);
}
Database::~Database() {
if(conn) {
delete[] conn;
}
}
Problem:
Database db;
db.Connect("127.0.0.1", "root", "mypassword", "mydb");
This will always return to false, even though I am using the exact same credentials with MySQL Administrator and logging in correctly.
Help :(