I am developing a WINAPI C++ program in which I need users to be able to log into accounts from a website. I have never integrated MySQL into a c++ program and I am running into this issue. My MySQL is hosted with my website by dreamhost.com so the MySQL server is not on my computer but it is with dreamhost. I am not sure what I am doing wrong here but I put in this info.
try {
sql::Driver *driver;
sql::Connection *con;
sql::ConnectOptionsMap connection_properties;
connection_properties["hostName"] = "localhost.domain.com";
connection_properties["userName"] = "MySQLUsername";
connection_properties["password"] = "MySQLPassword";
connection_properties["schema"] = "database";
connection_properties["port"] = 3306;
connection_properties["OPT_RECONNECT"] = true;
driver = get_driver_instance();
con = driver->connect(connection_properties);
delete con;
}
catch (sql::SQLException &e) {
std::ostringstream os;
os << "Error Number: " << e.getErrorCode();
MessageBoxA(NULL, os.str().c_str(), "MySQL Error", MB_OK |
MB_ICONINFORMATION);
}
It always catches error 1045. If i change the hostname it gives me 2005 or 2003 so I know it finds the host but for some reason wont access the database... Please help as this is halting my current project. The only answers I can find are for localhost servers.
I am using the username and password to PHPMyAdmin, is that correct?