[PyQt] QtSql connection fail where psycopg2 success?

Panupat Chongstitwattana panupatc at gmail.com
Wed Jan 11 11:55:43 GMT 2012


Thanks Andreas.

You're right I used windows binary installer. I don't seem to have the
postgresql.dll anywhere, nor can I find the Qt installation folder : /

Following your suggestion, lastError indead tells me drivers are not
loaded. But what makes me really confuse is that none of the drivers are
loading at all.

QtSql.QSqlDatabase.isDriverAvailable('QPSQL')
QtSql.QSqlDatabase.isDriverAvailable('QMYSQL')
QtSql.QSqlDatabase.isDriverAvailable('QSQLITE')

all returns False.

I tried download and install the latest binary package but still same
problem.

Any suggestion what I should try next?

Thanks.


On Wed, Jan 11, 2012 at 6:18 PM, Andreas Pakulat <apaku at gmx.de> wrote:

> On 11.01.12 18:03:52, Panupat Chongstitwattana wrote:
> > Where is Qt's plugin folder? I can only find this
>
> Whereever you installed Qt. If you took the PyQt4 windows binary
> package, then I don't know :|
>
> > C:\Python26\Lib\site-packages\PyQt4\plugins\sqldrivers
> >
> > It has 4 files in it.
> >
> > qsqlite4.dll
> > qsqlmysql4.dll
> > qsqlodbc4.dll
> > qsqlpsql4.dll
>
> That looks good, now you just need to ensure that the postgresql dll is
> also in your PATH when starting python so the qsqlpsql4.dll can find it.
>
> If thats also the case and its still not working, I'd suggest to check
> wether Qt really supports the driver via
> QSqlDataBase.isDriverAvailable(). You may also have some luck with
> checking isValid() after the addDatabase and maybe the lastError()
> function to get a proper message out.
>
> Andreas
>
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20120111/68b46596/attachment.html>


More information about the PyQt mailing list