[PyQt] QtSQL cant connect using MySQL driver

Christian Caron ccaron at fattoc.com
Mon Sep 7 23:38:52 BST 2009


By default, QtSql does't have support for mysql. You have to compile  
it by specifying the right options when ./configuring Qt for build.

Christian

On Sep 7, 2009, at 3:29 PM, Scott Ballard wrote:

> Hey list,
>
> Sorry to ask about this again, but I never got it working and was  
> pulled off onto something else. Now I have time to look into it again.
>
> I can't seem to get the qmysql driver to work with the QtSQL module  
> in PyQt 4.5.4 and Python 2.6.2 on Windows XP SP2.
>
> What exactly is required to make a connection to a MySql database  
> from PyQt? I have Wamp installed, running MySql and am able to  
> connect to it using the MySQLdb module.
>
> The qmysql4.dll is in the Python26\Lib\site-packages\PyQt4\plugins 
> \sqldrivers.
>
> Here's the important output:
> 2.6.2 (r262:71605, Apr 14 2009, 22:40:02) [MSC v.1500 32 bit (Intel)]
> PYQT_VERSION_STR: 4.5.4
> QSqlDatabase: QMYSQL driver not loaded
> QSqlDatabase: available drivers: QSQLITE QODBC3 QODBC QPSQL7 QPSQL
>
> Has anyone gotten this working? Are there any 3rd party DLLs that  
> need to be installed? Any hints would be welcome!
>
> Cheers,
> -Scott
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt



More information about the PyQt mailing list