<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">> Hi everybody! I am a newbie for PyQT.Now I am write a simple programm which<br>> use mysql as its database,but I find it is very diffucult to use the PyQT<br>
> APIs.I write sth like that:<br>><br>> db = QtSql.QSqlDatabase.addDatabase("QMYSQL")<br>> db.setHostName("<a href="http://127.0.0.1">127.0.0.1</a>")<br>> db.setDatabaseName("test")<br>
> db.setUserName("root")<br>> db.setPassword("123456")<br>> db.open()<br>><br>> but it just doesn't work. <snip><br><br>
<ul class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<li>Meaning? What does db.open() return, True or False? Does the database "test"<br>exist? And is Qt configured with MySQL support?<br><br>Or did you perhaps call these methods before you had created a QApplication or<br>
a QCoreApplication object? That won't work and the error messages aren't very<br>helpful for this case.<br><br>I can't test your code, because I don't have MySQL installed.<br><br>HTH<br>Sibylle</li></ul><br>
<br>--<br>Dr. Sibylle Koczian</blockquote></blockquote>
<div>Thank you for your reply!</div>
<div> I try to fix the problem as you told,but I failed finally.I think PyQt doesn't support mysql very well,because when I change </div>
<div><font color="#ff0000">db = QtSql.QSqlDatabase.addDatabase("QMYSQL")</font></div>
<div>to</div>
<div><font color="#ff0000">db = QtSql.QSqlDatabase.addDatabase("QSQLITE")</font></div>
<p>it works.So I decide to use mysqldb instead of PyQT's APIs</p>
<div><br> </div><br>