'Weird OleDbDataAdapter Fill behavior (hangs with explicit fields) on IBM i System

we're migrating our IBM i System from OS 6.0 to 7.4; we're testing all the applications which somehow connect and read/write data to it and we found a weird behavior in one of them.

The application is simply trying to fill a DataTable via OleDbDataAdapter:

Dim da As New OleDbDataAdapter
Dim dt As New DataTable
[...]
da.Fill(dt)

The query is a simple select similar to this:

SELECT field1, field2, field3 FROM table WHERE field1=something AND field2=something

.. and it returns 99% of the times (if not 100%) always an empty resultset (0 rows).

Problem is: the command da.Fill(dt) hangs for minutes most of the time with no specific reason or errors.

What's weird? If I replace the list of fields with *:

SELECT * FROM table WHERE field1=something AND field2=something

It works ALWAYS with no delays or glitches.

We really got no clues: could this be related to the new OS/400 version (7.4 instead of 6.0)? Maybe we need an updated ODBC driver (we're using a very old one)? I cannot say where the command is hanging (ODBC side? IBM side? ...), but on IBM i System everything seems just to be in idle..

Thanks!

--

I did other tests changing the query a bit, and this are the results:

's = "Select SNORAF, SRIAFF, SCDREG, SCDPRV, SCDCOM, SCDTIP, SCDTIQ, SPSC01 from             'KO
's = "Select SNORAF, SRIAFF, SCDREG, SCDPRV, SCDCOM, SCDTIP, SPSC01, SCDTIQ from             'KO
's = "Select SNORAF, SRIAFF, SCDREG, SCDPRV, SCDCOM, SCDTIP, SCDTIQ, SPSC01, SCDTIQ from     'OK
's = "Select SNORAF, SRIAFF, SCDREG, SCDPRV, SCDCOM, SCDTIP, SCDTIQ, SCDTIQ, SCDTIQ from     'OK
's = "Select SNORAF, SRIAFF, SCDREG, SCDPRV, SCDCOM, SCDTIP, SPSC01 from                     'OK
's = "Select * from                                                                          'OK
's = "Select SPSC01                                                                          'OK

On the right, the results: the first two queries didn't work, all the other ones work fine.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source