PDA

View Full Version : QSqlQuery always return junk value while for varchar oracle.



ranjit2709
6th August 2007, 13:54
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

marcel
6th August 2007, 13:59
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

ranjit2709
6th August 2007, 14:37
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

ranjit2709
7th August 2007, 06:19
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