PDA

View Full Version : SQL Anywhere ODBC



derick
29th September 2009, 22:10
Hi,

I'm having trouble with query.value(i).toString() where query is a QQuery ;)

- unixODBC on Ubuntu
- Qt 4.5.2

The error message is:

qGetStringData: Error while fetching data ( "[Sybase][ODBC Driver]Invalid string or buffer length" )

The code runs fine when using the native OCI driver, but with SQL Anywhere I need to pass via ODBC.

Anybody ran across this?

vieraci
13th December 2009, 16:08
I've a similar message:

qGetStringData: Error while fetching data
The message repeats for every column of the QSqlQuery.
The line that causes this for me is:

QSqlRecord rec = aSqlQuery->record()
The database driver db2 and it only happens when the function is called a second or third time,
but it doesn't seem to be a problem as everything seems to work ok.
I traced it back to the source file qsql_db2.cpp and it's a result of a call to SQLGetData() but I can't find the source file for this.

Tanuki-no Torigava
14th December 2009, 09:32
Hi, I'm using ODBC to MSSQL. In fact the stuff like Sybase. If you do it under Linux I suggest you to switch to FreeTDS (http://www.freetds.org/). It works much better and faster than ODBC and supports Sybase data tabular streams.

Cheers,
-- tanuki

derick
19th December 2009, 17:56
I've ran the same code on Windows, and I do not have this issue.

derick
19th December 2009, 18:07
Hi, I'm using ODBC to MSSQL. In fact the stuff like Sybase. If you do it under Linux I suggest you to switch to FreeTDS (http://www.freetds.org/). It works much better and faster than ODBC and supports Sybase data tabular streams.

Cheers,
-- tanuki

I have a v9 .db / .dbf file that I need to access. I've looked at some settings in the freetds.conf file and did a quick scan of the document but could not find a way to do it.

Does anyone have an idea on how to do that?

Thanks!
D.

Tanuki-no Torigava
20th December 2009, 04:02
You can look here (http://blog.marcingil.com/2009/11/linux-odbc-to-mssql/) for a good MS SQL example. Sybase should go the same way.

Regards,
-- tanuki

tangential
22nd December 2009, 05:04
I really don't recommend FreeTDS, 0.82 has issues with unicode strings, and the TDS guys are working with us to get their ODBC support top notch.
If you have a simple example application that fails, definitely, post a bug over at http://bugreports.qt.nokia.com

ODBC string retrieval code had a bug fixed for 4.6.0, so maybe try that, and it may start working again for you.