Database Connection on Mac
I am trying to connect to a database on my mac but looks nothing works. I am really newbie and following documentations, tutorial.
I have setup MySQL workbench and XAMPP running on my mac but all I get is
ERROR: "[iODBC][Driver Manager]Data source name not found and no default driver specified. Driver could not be loaded QODBC3: Unable to connect"
I tried to follow this:
Am I taking a totally wrong path?
My Conde is as simple as:
int main(int argc, char *argv)
QCoreApplication a(argc, argv);
QSqlDatabase db =QSqlDatabase::addDatabase("QODBC");
Well, the error message tells you that "test" is not a data source name (DSN) known to your ODBC install. From the "documentation": http://qt-project.org/doc/qt-5.0/qtsql/sql-driver.html#qodbc for the QODBC plugin:
bq. Be aware that when connecting to an ODBC datasource you must pass in the name of the ODBC datasource to the QSqlDatabase::setDatabaseName() function rather than the actual database name.
There is a native MySQL database driver plugin that you could (should) be using instead.
Thank you. To me seems there is something wrong with by DB setup. In JDBC using Eclipse, we need to download a JAR file then set the path in Eclipse. Does this apply in here too?
I tried to follow this tutorial
I believe my connection string is somehow wrong. Here is what I found in SQL documentation for connection string
@QString dsn = QString("Server=127.0.0.1;Database=test;Uid=root;Pwd=");@
does it look right?