MYSQL C++ Connector Freezes

Hi guys when I use the method connect my program to MYSQL it crashes for some reason and I am wondering if any of you have any ideas?
loc, usr,pass are all c++ strings

driver = get_driver_instance();
con = driver->connect(loc,usr,pass);//crashes here
con->setSchema("accountDB");
isConnectedDB=1;

There is no way to answer that without more information. What type is driver and how does the interface of connect look like. And it could be life time issues depending on what connect does with the parameters. So you would need to post some more code that shows the whole function. And also, what is the crash you get, whats the error code?

thanks for the response but I figured it out. When I am done I will post a link to the Github page here.

Your code is valid. I have the exact same code in my project atm.

are you sure its that code crashing it? not code later on, cause I know it can get funky with exectueQuery and getdata

It just sorta works now, the problem is that I was entering the wrong password and the debugger wouldnt go to the catch block but now it works and if you enter the wrong password in my UI in my program it will flash with a red warning saying that it failed to connect.

ahh, make sure you catch and print out the sql errors. helps with debugging... allot

Here is my "finnished product".