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.
--- Begin Message ---
Return-Path: <[EMAIL PROTECTED]>
Delivered-To: [EMAIL PROTECTED]
Received: (qmail 26426 invoked by uid 1010); 19 Sep 2007 12:18:08 +0200
Received: from 209.249.12.202 by centrodatos (envelope-from <[EMAIL 
PROTECTED]>, 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: [EMAIL PROTECTED] 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 <[email protected]>; 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 ([EMAIL PROTECTED]@87.220.87.100) by centrodatos
        (envelope-from <[EMAIL PROTECTED]>, 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: [EMAIL PROTECTED] 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?)
        ([EMAIL PROTECTED]@87.220.87.100)
        by linos.es with SMTP; 19 Sep 2007 12:07:50 +0200
Message-ID: <[EMAIL PROTECTED]>
Date: Wed, 19 Sep 2007 12:16:37 +0200
From: Linos <[EMAIL PROTECTED]>
User-Agent: Thunderbird 2.0.0.6 (X11/20070803)
MIME-Version: 1.0
To: [email protected]
Content-Type: text/plain; charset=ISO-8859-15
Content-Transfer-Encoding: 7bit
Subject: [PyQt] ODBC QSqlQuery
X-BeenThere: [email protected]
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:[EMAIL PROTECTED]>
List-Archive: <http://www.riverbankcomputing.com/pipermail/pyqt>
List-Post: <mailto:[email protected]>
List-Help: <mailto:[EMAIL PROTECTED]>
List-Subscribe: <http://www.riverbankcomputing.com/mailman/listinfo/pyqt>,
        <mailto:[EMAIL PROTECTED]>
Sender: [EMAIL PROTECTED]
Errors-To: [EMAIL PROTECTED]

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    [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


--- End Message ---
_______________________________________________
PyQt mailing list    [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to