Page 1 of 1
Query to DB2 on AS/400 only returns 1 row
Posted: Sun 11 Sep 2011 20:23
by rmonares
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.
Posted: Mon 12 Sep 2011 12:01
by AlexP
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.
Posted: Tue 13 Sep 2011 17:00
by rmonares
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.
Posted: Wed 14 Sep 2011 14:58
by AlexP
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.
Posted: Wed 14 Sep 2011 22:27
by rmonares
We'll look into upgrading the odbc drivers. We just bought unidac a week ago. Very glad you have good support. Thanks.
Posted: Thu 15 Sep 2011 07:26
by AlexP
Hello,
If you have any other questions, feel free to contact us.