[PyQt] Re: Build PyQt with sql Driver plugins
Linos
info at linos.es
Thu Sep 27 12:01:19 BST 2007
Paulino escribió:
> Linos escreveu:
>> paulino1 at sapo.pt escribió:
>>
>>> Citando Linos <info at linos.es>:
>>>
>>>
>>>> paulino1 at sapo.pt escribió:
>>>>
>>>>> Citando Linos <info at linos.es>:
>>>>>
>>>>>
>>>>>> Paulino escribió:
>>>>>>
>>>>>>> *>Linos* info at linos.es
>>>>>>> <mailto:pyqt%40riverbankcomputing.com?Subject=%5BPyQt%5D%20Build%20PyQt%20with%20sql%20Driver%20plugins&In-Reply-To=200709251523.53366.phil%40riverbankcomputing.co.uk>
>>>>>>>
>>>>>>>
>>>>>>> />Tue Sep 25 22:21:33 BST 2007/
>>>>>>> ------------------------------------------------------------------------
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>> The last version in windows works very well for me with odbc support
>>>>>>>> but i have compilend by hand (sip
>>>>>>>> and pyqt, qt installed from binary) i dont know if binary packages
>>>>>>>> fail, i have a problem with odbc in
>>>>>>>> linux but in windows works very well.
>>>>>>>>
>>>>>>> I have also compiled by hand sip and PyQt, and instaled qt from
>>>>>>> binary, but didn't got QODBC available.
>>>>>>>
>>>>>>> What options did you gave the PyQt's configure.py?
>>>>>>>
>>>>>>>
>>>>>>> Paulino
>>>>>>>
>>>>>>>
>>>>>> Paulino i am using gcc 3.4.5 from mingw, PyQt-win-gpl-4.3, sip-4.7,
>>>>>> python 2.5.1 and
>>>>>> qt-win-opensource-4.3.1-mingw, i compile pyqt whithout any options in
>>>>>> configure.py, it detects qsql and
>>>>>> qodbc while compiling and works ok.
>>>>>>
>>>>>>
>>>>> I used the same packages you refer!
>>>>>
>>>>> I wonder why it didn't detected QODBC ????
>>>>>
>>>>> Paulino
>>>>>
>>>>>
>>>> i have in c:\qt\4.3.1\plugins\sqldrivers\ the files:
>>>>
>>>> libqsqlodbc4.a
>>>> qsqlodbc4.dll
>>>>
>>>> do you have the same?
>>>>
>>>>
>>> Yes, and also:
>>> libqsqlite4.a
>>> qsqlite4.dll
>>>
>>> But don't have any driver available.
>>>
>>> Paulino
>>>
>>>
>>
>> i would try recompiling sip and later pyqt, if you have no luck i can try in other virtual machine to see
>> if it works for me other time.
>>
>>
>>
> I tried for 3 times - one on a clean virtual machine. No drivers available.
Paulino i have tried today in a clean virtual machine and it works for me, i have done this:
install mingw-5.1.3.exe
install qt-win-opensource-4.3.1-mingw.exe
install python-2.5.1.msi
install pywin32-210.win32-py2.5.exe
add to system path variable: c:\python25;C:\MinGW\libexec\gcc\mingw32\3.4.2;c:\MinGW\bin;C:\Qt\4.3.1\bin
cd into sip-4.7 directory:
python configure.py
mingw32-make
mingw32-make install
cd into PyQt-win-gpl-4.3
python configure.py
mingw32-make
mingw32-make install
And later it works well for me, i have odbc drivers and it works, i connect to an odbc source with this code.
-----------------------------------------------------------------------------------------------------------------------------
import os, sys
from PyQt4.QtCore import *
from PyQt4.QtSql import *
from PyQt4.QtGui import *
def conectarMaxdb():
'''conexion via ODBC con QT a MAXDB'''
maxdb = QSqlDatabase.addDatabase("QODBC", 'maxdb')
maxdb.setDatabaseName("DRIVER={MaxDB (Unicode)};HOSTNAME=192.168.1.20;DATABASE=MAXDB2") --> windows
code dsn less
maxdb.setUserName("FAKE")
maxdb.setPassword("FAKE")
aperturamaxdb = maxdb.open()
if not aperturamaxdb:
QMessageBox.warning(None, "Error conexion con la DB", QString("Database Error:
%1").arg(maxdb.lastError().text()))
sys.exit(1)
return maxdb
if __name__ == "__main__":
app = QApplication(sys.argv)
dbmaxdb = conectarMaxdb()
print dbmaxdb.isOpen() -----> print True
print dbmaxdb.isValid() ----> print True
-----------------------------------------------------------------------------------------------------------------------------
I hope this can help you.
Best Regards,
Miguel Angel.
More information about the PyQt
mailing list