<br><tt><font size=2>On 04.05.07 20:22:47, </font></tt><a href=http://www.riverbankcomputing.com/mailman/listinfo/pyqt><tt><font size=2 color=blue><u>marion.balthasar
at ise.fraunhofer.de</u></font></tt></a><tt><font size=2> wrote:<br>
><i> >from PyQt4.QtSql import *<br>
</i>><i> >from PyQt4.QtCore import *<br>
</i>><i> <br>
</i>><i> class Database:<br>
</i>><i> <br>
</i>><i> def __init__(self):<br>
</i>><i> <br>
</i>><i> self.db=QSqlDatabase.addDatabase("QPSQL")<br>
</i>><i> self.db.setHostName("localhost")<br>
</i>><i> self.db.setDatabaseName("klimadaten")<br>
</i>><i> self.db.setUserName("postgres")<br>
</i>><i> self.db.setPassword("post")<br>
</i>><i> <br>
</i>><i> self.db.open()<br>
</i>><i> self.db.QSqlDatabase.lastError().text()<br>
</i>><i> <br>
</i>><i> <br>
</i>><i> <br>
</i>><i> But when i start "run module" in IDLE there is no
message at all, no <br>
</i>><i> error-message, nothing...<br>
</i>><i> <br>
</i>><i> I think I missed to add parts in the source, but as i'm not
really used to <br>
</i>><i> python scripting, i can't figure out now, which one it may
be,<br>
</i><br>
This only declares a class, you need to create an instance of the class,<br>
add something like<br>
<br>
c=Database()<br>
<br>
at the end of the script.<br>
<br>
><i> >from PyQt4.QtSql import *<br>
</i>><i> QSqlDatabase.addDatabase("QPSQL")<br>
</i>><i> <br>
</i>><i> in Python Interpreter, then the error-message "QSqlDatabase:
driver not <br>
</i>><i> loaded<br>
</i>><i>
QSqlDatabase:
<br>
</i>><i> available drivers <br>
</i>><i> PyQt4.QtSql.QSqlDatabase object at 0x008E58A0"<br>
</i><br>
That means your PyQt doesn't have the qt psql plugin, did you install Qt<br>
yourself or did you use a distro package? If the former then make sure<br>
your Qt was built with the postgres plugin, its in<br>
<qt-install-dir>/plugins/sqldrivers and called libqsqlpsql.so.<br>
<br>
><i> Maybe I have to make some more specific determinations to the driver?<br>
</i><br>
No, but the driver also needs to find its dependecies, i.e. it needs to<br>
find the postgresql client library. Run ldd libqsqlpsql.so to see wether<br>
any libs are missing.<br>
<br>
Andreas</font></tt>
<br>
<br><tt><font size=2>Andreas, Matt, thanks a lot for your replies!!</font></tt>
<br>
<br><tt><font size=2>I finally figured out (due to your hints), that i
didn't had the driver built. So i'm now running a new built of Qt including
psql :-)</font></tt>
<br><tt><font size=2>when i first installed qt, i used the precompiled
binary package for windows.. but now I've explicitely mentioned in configuration
to built psql!!</font></tt>
<br><tt><font size=2>Although i know, that this probably means, that i
have to reinstall sip and pyqt as well... (am i right?)</font></tt>
<br>
<br><tt><font size=2>last but not least, i really have to improve, or better
practise programming... ;-) i will also post the upcoming problems here
;-))</font></tt>
<br>
<br><tt><font size=2>have a nice evening!</font></tt>
<br>
<br><tt><font size=2>marion</font></tt>
<br>
<br>
<br>