1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

CLI0145E Fetch type out of range.

Discussion in 'Java' started by daiondoroga, Aug 12, 2006.

  1. daiondoroga

    daiondoroga New Member

    Joined:
    Aug 12, 2006
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    0
    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
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,287
    Likes Received:
    364
    Trophy Points:
    83
    Can you elaborate a bit more on when and where you are getting the errors.
     
  3. daiondoroga

    daiondoroga New Member

    Joined:
    Aug 12, 2006
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    0
    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
     
  4. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,287
    Likes Received:
    364
    Trophy Points:
    83
    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:
    ResultSet rs = executeQuery("SELECT COUNT(*) AS rowcount FROM MyTable");
    rs.next();
    int RocordCount = rs.getInt("rowcount") ;
    rs.close() ;
     

Share This Page