[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: [Fwd: [PyQt] ODBC QSqlQuery]
From: Linos <info () linos ! es>
Date: 2007-09-23 11:23:24
Message-ID: 46F64CAC.1050102 () linos ! es
[Download RAW message or body]
Hello,
no one has been the same problem? anyone has used odbc access with pyqt4 with qt4 in linux with sucess?
i cant find a solution myself...
Regards,
Miguel Angel.
["[PyQt] ODBC QSqlQuery.eml" (message/rfc822)]
Return-Path: <pyqt-bounces@riverbankcomputing.com>
Delivered-To: info@linos.es
Return-Path: <pyqt-bounces@riverbankcomputing.com>
Delivered-To: linos.es-info@linos.es
Received: (qmail 26426 invoked by uid 1010); 19 Sep 2007 12:18:08 +0200
Received: from 209.249.12.202 by centrodatos (envelope-from \
<pyqt-bounces@riverbankcomputing.com>, uid 1009) with qmail-scanner-2.01st (clamdscan: \
0.90.1/2930. spamassassin: 3.1.8. perlscan: 2.01st. \
Clear:RC:0(209.249.12.202):SA:0(4.4/7.0):. Processed in 4.120808 secs); 19 Sep 2007 10:18:08 \
-0000
X-Spam-Status: No, hits=4.4 required=7.0
X-Spam-Level: ++++
X-Antivirus-LINOS-Mail-From: pyqt-bounces@riverbankcomputing.com via centrodatos
X-Antivirus-LINOS: 2.01st (Clear:RC:0(209.249.12.202):SA:0(4.4/7.0):. Processed in 4.120808 \
secs Process 26403)
Received: from 209-249-12-202.ip.openhosting.com (HELO riverbankcomputing.com) (209.249.12.202)
by linos.es with SMTP; 19 Sep 2007 12:18:04 +0200
Received: from rvrbank.user.openhosting.com (rvrbank.user.openhosting.com [209.249.12.202])
by riverbankcomputing.com (8.13.6/8.13.6) with ESMTP id l8JAGneg010182;
Wed, 19 Sep 2007 11:17:07 +0100
Received: from linos.es (centrodatos.linos.es [86.109.104.181])
by riverbankcomputing.com (8.13.6/8.13.6) with ESMTP id l8JAGldZ010169
for <pyqt@riverbankcomputing.com>; Wed, 19 Sep 2007 11:16:48 +0100
Received: (qmail 23647 invoked by uid 1010); 19 Sep 2007 12:07:53 +0200
Received: from 87.220.87.100 (info@linos.es@87.220.87.100) by centrodatos
(envelope-from <info@linos.es>, uid 1009) with qmail-scanner-2.01st
(clamdscan: 0.90.1/2930. spamassassin: 3.1.8. perlscan: 2.01st.
Clear:RC:0(87.220.87.100):SA:0(5.6/7.0):.
Processed in 3.453316 secs); 19 Sep 2007 10:07:53 -0000
X-Antivirus-LINOS-MOVED-X-Spam-Status: No, hits=5.6 required=7.0
X-Antivirus-LINOS-MOVED-X-Spam-Level: +++++
X-Antivirus-LINOS-Mail-From: info@linos.es via centrodatos
X-Antivirus-LINOS: 2.01st (Clear:RC:0(87.220.87.100):SA:0(5.6/7.0):. Processed
in 3.453316 secs Process 23609)
Received: from 100.87.220.87.dynamic.jazztel.es (HELO ?192.168.1.4?)
(info@linos.es@87.220.87.100)
by linos.es with SMTP; 19 Sep 2007 12:07:50 +0200
Message-ID: <46F0F705.4030504@linos.es>
Date: Wed, 19 Sep 2007 12:16:37 +0200
From: Linos <info@linos.es>
User-Agent: Thunderbird 2.0.0.6 (X11/20070803)
MIME-Version: 1.0
To: pyqt@riverbankcomputing.com
Content-Type: text/plain; charset=ISO-8859-15
Content-Transfer-Encoding: 7bit
Subject: [PyQt] ODBC QSqlQuery
X-BeenThere: pyqt@riverbankcomputing.com
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: Python Bindings for Qt and KDE <pyqt.riverbankcomputing.com>
List-Unsubscribe: <http://www.riverbankcomputing.com/mailman/listinfo/pyqt>,
<mailto:pyqt-request@riverbankcomputing.com?subject=unsubscribe>
List-Archive: <http://www.riverbankcomputing.com/pipermail/pyqt>
List-Post: <mailto:pyqt@riverbankcomputing.com>
List-Help: <mailto:pyqt-request@riverbankcomputing.com?subject=help>
List-Subscribe: <http://www.riverbankcomputing.com/mailman/listinfo/pyqt>,
<mailto:pyqt-request@riverbankcomputing.com?subject=subscribe>
Sender: pyqt-bounces@riverbankcomputing.com
Errors-To: pyqt-bounces@riverbankcomputing.com
Hello, i have a problem with QSqlQuery accessing a dsn in linux, i have no problem with exactly \
the same code in windows and i check i have correctly opened the datasource, here i paste the \
relevant code snippets.
-----------------------------------------------------------------------------------------------------------------------------
import os, sys, time, re
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.setDatabaseName("DRIVER={MAXDB};ServerNode=192.168.1.20;ServerDB=MAXDB2") --> linux code \
dsn less #maxdb.setDatabaseName("DATABASE") --> linux code with dsn
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
query1maxdb =QSqlQuery(dbmaxdb)
query1maxdb.exec_(QString("SELECT * FROM DATOS_ANTIGUOS.CLIENTES_ANTIGUO WHERE \
CLI='011113'")) query1maxdb.next()
print query1maxdb.isValid() ---> print False in linux, True in windows
-----------------------------------------------------------------------------------------------------------------------------
When i use unixODBC commandline tool isql with "isql DATABASE FAKE FAKE" i can do SQL commands \
in the datasource, i have tested in gentoo (gentoo ebuilds) and debian (hand-compiled) with \
exactly the same results, the same code works well in windows (i only have to uncomment, \
comment the setDatabaseName method because changes in param names), anyone knows what can be \
the problem?
Best Regards,
Miguel Angel.
_______________________________________________
PyQt mailing list PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
_______________________________________________
PyQt mailing list PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic