Results 1 to 4 of 4

Thread: QSqlQuery always return junk value while for varchar oracle.

  1. #1
    Join Date
    Jul 2007
    Posts
    3
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default QSqlQuery always return junk value while for varchar oracle.

    Hi Friends,

    We are using Qt windows evaluation version and trying to connect to Oracle with QODBC3 driver. I am able to do connection to Oracle server and execute the queries successfully. But the result retrieved is always returning same junk value for VARCHAR2 column only.

    Please see the attached image file.

    Thanks in advance......

    Regards,
    Ranjit

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QSqlQuery always return junk value while for varchar oracle.

    What encoding do you use in the db?
    Also, about the query's QVariant value:
    An invalid QVariant is returned if field index does not exist, if the query is inactive, or if the query is positioned on an invalid record.
    Make sure those don't happen.

    Regards

  3. #3
    Join Date
    Jul 2007
    Posts
    3
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QSqlQuery always return junk value while for varchar oracle.

    Thanks Marcel for quick reply...

    Actually we are using 'WE8ISO8859P1' encoding schema.
    I have taken care about what you told about QVariant.

    Which encoding does Qt recommends to use? is there any problem using 'WE8ISO8859P1' encoding.


    Thanks,
    Ranjit

  4. #4
    Join Date
    Jul 2007
    Posts
    3
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QSqlQuery always return junk value while for varchar oracle.

    Found solutions....

    Unicode Support

    The QODBC Plugin will use the Unicode API if UNICODE is defined. On Windows NT based systems, this is the default. Note that the ODBC driver and the DBMS must also support Unicode.

    For the Oracle 9 ODBC driver (Windows), it is neccessary to check "SQL_WCHAR support" in the ODBC driver manager otherwise Oracle will convert all Unicode strings to local 8-bit.


    Just make sure you enable the "Force SQL_WCHAR support" in ODBC driver manager's workaround tab...


    Regards,
    Ranjit

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.