I got a Statement from a Connection object and then called setMaxRows() on the Statement Object. It works fine, but now every Statement I get from that same Connection Object has the same max row setting so my ResultSets are missing some rows. What is wrong ?
This problem was fixed in all versions of JTurbo 3.x.
When you call setMaxRows(n) on a Statement Object, JTurbo was sending the following message to SQL Server:
set rowcount n
This causes SQL Server to only return n rows for all queries made using that same Connection
[thus reducing network traffic which is the main idea behind using setMaxRows() in the first place ].
There are a few workarounds to this problem.
Get JTurbo 3.x or newer which corrects this problem
Do not call setMaxRows.
Instead modify your query so that it uses the TOP command like this:
Select top 200 * from myTable
After you call setMaxRows(n), and after you get back the limited ResultSet that you need,
but before you call stmt.close(),
call setMaxRows(0) to set the Statement (and thus the underlying Connection)
back to an unlimited number of rows.
Note: workaround #2 is especially important if you are using Connection Pooling.
Note: Readers of this FAQ may also find FAQ #82 to be of interest.