What database and why?
-
Could it be that you haven't given the correct server name for the database server you're using?
Try changing this line:
@db.setHostName("localhost");@
to use the IP address of your database server. Also I'm pretty sure MySQL requires the root account to have a password.
-
-
[quote author="Andre" date="1298273948"]It is really very simple. Your code is not at fault (at least, it is not the main issue). The error message is quite clear: your Qt MySql driver plugin is not loaded. Did you actually build it? It is not build by default when you install the SDK... [/quote]
Hi Andre, i've tryed to read a bit some places about this, and yes I do know about the missing driver thats why I posted the compile output :].
what I'm wondering is it possible to connect to mysql without having to recompile example by using
QODBC Drivers.
-
You might be able to use ODBC, but if possible, you'll want to avoid that and use the direct driver instead. ODBC is not known for its speed...
The MySQL driver by default only comes in sourcecode format, so you'll have to build it yourself. Depending on the platform you're on, that is really not so hard. You don't need to recompile all of Qt, just compile the driver.
-
[quote author="Andre" date="1298371048"]You might be able to use ODBC, but if possible, you'll want to avoid that and use the direct driver instead. ODBC is not known for its speed... The MySQL driver by default only comes in sourcecode format, so you'll have to build it yourself. Depending on the platform you're on, that is really not so hard. You don't need to recompile all of Qt, just compile the driver.[/quote]
if you have time could you please provide my the link where it explain step by step how to compile the drivers for mysql under windows and linux. ( I heard that linux you can use a sudo apt-get under unbuntu for the drivers already compiled ).
-
Perhaps "this":http://christopher.rasch-olsen.no/2009/04/14/qt-45-and-mysql-plugin-with-mingw-on-windows-xp/ will give you a head start? I have found other guides (Google is your friend!), but they are basically the same idea. Note however that you do NOT need to rebuild all of Qt, as the guide linked above suggests. Simply issue the mingw32-make command in the driver directory instead.
-
I know this is a ol post but I used this to be able to use MySQL on windows if it can help anyone.
http://ieatbinary.com/2011/07/11/how-to-enable-mysql-support-in-qt-sdk-for-windows/
-
Hi dsylebee. If you understand french, see this simple tutorial :
http://www.siteduzero.com/tutoriel-3-267200-maitrisez-les-bases-de-donnees-avec-qtsql.htmlgood luck !
-
I do understand French though the topic is not about knowing how to use queries it's how to compile the drivers of MySQL for QT, but thanks anyways.
[quote author="issam" date="1341397726"]Hi dsylebee. If you understand french, see this simple tutorial :
http://www.siteduzero.com/tutoriel-3-267200-maitrisez-les-bases-de-donnees-avec-qtsql.htmlgood luck ![/quote]