Skip to Content
avatar image
Former Member

error while fetching the values from database

hiii all,

I have a dynpro project where i am using JDBC codes to fetch data from tables. I have used 2SQL queries...in the first query i am fetching values from 2tables and taking the result from this i run another query.As a result i expect 19591 records as the output....

1)when i put while loop for 19000, 19000records are being within 1min.....

2)when i put while loop for 20000, exception is thrown as :

ArrayIndexOutOfboundsException : size:19591,i:19591

i is variable for while loop

3)when i dont put any condition for while loop, itz taking unlimited time and output is not displayed....

please do help out...

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Jun 06, 2008 at 06:52 AM

    The problem seems that you are trying to fetch a record by giving a count that doesnot exist in the database.

    Try to get the table count and instead of using a hard-coded value like 20000, use this value in the condition for ' for-loop'.

    Also without a condition the for -loop is expected to take a long time till the application gives a time-out error.

    Regards,

    Sudeep

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 06, 2008 at 06:53 AM

    Hi,

    change your while loop as follows

    rs is an object of resultset

    while(rs.next())

    {

    // do what you are doing

    }

    If this doesnt help pl post your code.

    Regards

    Ayyapparaj

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member srinivas sistu

      group_rs1 = group_st1.executeQuery("SELECT A.JOINT_ID,C.LINE_ID FROM EALPS_DRWREVSPLJTS A,EALPS_DRW_REV_SPL B,EALPS_DRW_REV_LINE C WHERE"

      + " B.SPOOL_ID=A.SPOOL_ID AND B.LINE_ID=C.LINE_ID");

      //group_rs1=group_st1.executeQuery("SELECT D.TESTLEVELNO FROM EALPS_EALPS_DRWREVSPLJTS A,WELDTESTCRIT D WHERE D.WELD_TEST_CRIT_ID=A.WELDTEST_CRI_ID ");

      //wdComponentAPI.getMessageManager().reportSuccess("connection.toString ="+conn.toString());

      int index1=0;

      while(group_rs1.next())

      {

      arr_joint_id.add((group_rs1.getString(1)));

      arr_line_id.add(group_rs1.getString(2));

      index1++;

      }

      for(int i = 0; i <arr_joint_id.size(); i++)

      {

      String joint_id = arr_joint_id.get(i).toString();

      group_rs = group_st.executeQuery("SELECT A.SIZE_NBMM,A.ISFIELDJOINT,A.WELDTEST_CRI_ID,D.TESTLEVELNO,E.COMPLETE FROM EALPS_DRWREVSPLJTS A,EALPS_WELDTESTCRIT D,EALPS_ACTV_SEQ E WHERE"

      + " A.JOINT_ID='" + joint_id +"' OR D.WELD_TEST_CRIT_ID=A.WELDTEST_CRI_ID OR E.JOINT_ID=A.JOINT_ID");

      }

      int index = 0;

      while(group_rs.next())

      {

      //wdComponentAPI.getMessageManager().reportSuccess("inside while loop");

      arr_size.add(new Float(group_rs.getFloat(1)));

      arr_isfieldjoint.add(group_rs.getString(2));

      arr_weldtest_cri_id.add(new Long(group_rs.getLong(3)));

      arr_testlevelno.add(group_rs.getString(4));

      arr_complete.add(group_rs.getString(5));

      index++;

      }

      thanks a lot for pointing out my mistake that i was taking the last resultset and performing operations on that only....

      please go thru my code,i have changed them....now i am taking all the values from each of the record-sets...............but now itz taking infinite time after which the page is exprining....can u plzz suggest.............