Query to DB2 on AS/400 only returns 1 row

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
rmonares
Posts: 4
Joined: Sun 11 Sep 2011 20:07

Query to DB2 on AS/400 only returns 1 row

Post by rmonares » Sun 11 Sep 2011 20:23

Hi

I'm executing a query on DB2 on as/400 and the result only has 1 row. This only happens on some tables. But if I execute the same query using AnySQL Maestro, the result set is correct. I'm using ODBC and Client Access to connect to AS/400.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Mon 12 Sep 2011 12:01

Hello,

Try to set the value of the FetchRows property to 1 and execute your query once more. If this time the query returns the correct number of lines, the problem is connected with your ODBC driver, that “expands” dataset incorrectly. In this case you need to contact its developers.
If the query returns only one line after setting this option to 1, contact us once more.

rmonares
Posts: 4
Joined: Sun 11 Sep 2011 20:07

Post by rmonares » Tue 13 Sep 2011 17:00

Thanks a lot !! Setting FetchRows to 1 got all the correct rows in the query. But your comment about this solution seems strange, as running the query in AnySQL Maestro and Excell returns all rows.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Wed 14 Sep 2011 14:58

Hello,

Each ODBC driver should support row-wise binding according to http://msdn.microsoft.com/en-us/library/ms403318.aspx

The first problem of your ODBC driver is that this driver doesn't support row-wise binding. UniDAC can use ODBC drivers that don't support row-wise binding. But in this case if ODBC driver doesn't support row-wise binding, it should return error code on trying to set the SQL_ATTR_ROW_BIND_TYPE parameter to a value different from SQL_BIND_BY_COLUMN. But your ODBC driver returns SQL_SUCCESS.

You should ask developers of your ODBC driver to support row-wise binding or return any error code different from SQL_SUCCESS on trying to set the SQL_ATTR_ROW_BIND_TYPE parameter to a value different from SQL_BIND_BY_COLUMN.

P.S. AnySQL Maestro may be using the second way of receiving data (by columns) by default, and that's why it may be working correctly with your ODBC driver.

rmonares
Posts: 4
Joined: Sun 11 Sep 2011 20:07

Post by rmonares » Wed 14 Sep 2011 22:27

We'll look into upgrading the odbc drivers. We just bought unidac a week ago. Very glad you have good support. Thanks.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Thu 15 Sep 2011 07:26

Hello,

If you have any other questions, feel free to contact us.

Post Reply