Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Java (http://www.go4expert.com/forums/java/)
-   -   CLI0145E Fetch type out of range. (http://www.go4expert.com/forums/cli0145e-fetch-type-range-t1173/)

daiondoroga 12Aug2006 15:15

CLI0145E Fetch type out of range.
 
Hi,
When i try to call resultset.last() method on scrollable resultset i am getting the following error message :
COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver] CLI0145E Fetch type out of range. SQLSTATE=HY106

I am using Visual Age for Java.

Can any one help me in this problem?

Thanks

shabbir 12Aug2006 17:33

Re: CLI0145E Fetch type out of range.
 
Can you elaborate a bit more on when and where you are getting the errors.

daiondoroga 12Aug2006 19:47

Re: CLI0145E Fetch type out of range.
 
I have choosen TYPE_SCROLL_INSENSITIVE and CONCUR_READ_ONLY
options for the resultset. Basically I want to get the row count in the resultset. So first method i am calling is resultSet.last(), there itself I could not proceed. Later I am using other methods like getRow(), first(), but I could not go till there.
Do u have any clue why is it giving exception?

Thanks

shabbir 13Aug2006 08:27

Re: CLI0145E Fetch type out of range.
 
Quote:

Originally Posted by daiondoroga
Basically I want to get the row count in the resultset. So first method i am calling is resultSet.last(), there itself I could not proceed.

Do not use resultSet.last() to get the no of row count as that will not return you the count properly instead use the count SQL something like
Code: JAVA

ResultSet rs = executeQuery("SELECT COUNT(*) AS rowcount FROM MyTable");
rs.next();
int RocordCount = rs.getInt("rowcount") ;
rs.close() ;



All times are GMT +5.5. The time now is 14:05.