Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: please help as soon as possible..thanks in advance

  1. #1
    Junior Member
    Join Date
    Jan 2013
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default please help as soon as possible..thanks in advance

    hi i am unable to sort out an error in my code as below:


    Array arr = cstmt.getArray(3);
    rs = arr.getResultSet();
    while (rs.next())
    {
    STRUCT struct = (STRUCT)rs.getObject(2);

    Object[] cols = struct.getAttributes();

    // Store the result set data
    Object[] row = cols.clone();

    for (int i = 0; i < row.length; i++)
    {
    if(i!=1&&i!=2&&i!=9&&i!=10)
    {
    List<Object[]> innerList =new ArrayList<Object[]>();
    Array innerArray = (Array)row[i];

    try
    {
    ResultSet rs1 = innerArray.getResultSet();

    while (rs1.next())
    {
    STRUCT innerStruct = (STRUCT)rs1.getObject(2);

    Object[] innerCols = innerStruct.getAttributes();

    Object[] innerRow = innerCols.clone();

    for (int j = 0; j < innerRow.length; j++)
    {
    if (innerRow[j] == null)
    innerRow[j] = "";
    }

    innerList.add(innerRow);
    }

    if(rs1 != null)
    {
    rs1.close();

    rs1 =null;
    }
    }catch(NullPointerException e)
    {
    logger.info("Exception in inner array in EMLGenerator"+e.getStackTrace());
    }

    row[i] = innerList;

    }
    else
    {
    if (row[i] == null) row[i] = "";
    }

    }

    complexData.add(row);
    }//end of while

    }//end of else

    }catch(NullPointerException e)
    {
    System.out.println("Excetipn NULL Pointer"+e.getStackTrace());
    }

    finally
    {
    if (cstmt != null) cstmt.close();
    if (rs != null) rs.close();
    }
    }


    error is in line Array innerArray = (Array)row[i]; where it is giving a type casting error of string to array..

    please help..

    your valuable thoughts are welcomed..


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,180
    My Mood
    Hungover
    Thanks
    141
    Thanked 601 Times in 516 Posts

    Default Re: please help as soon as possible..thanks in advance

    What does this have to do with web frameworks, which is the forum you posted this in? Is this even Java code?

    Please use the highlight tags to preserver formatting when posting code. Also, please use descriptive titles. See the link in my signature on asking smart questions for more information.

    What is row? What does it contain? What are you trying to get out of it?
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

Similar Threads

  1. how to learn advance java?
    By prateek in forum Member Introductions
    Replies: 1
    Last Post: November 5th, 2012, 11:58 PM
  2. advance Jframe operation
    By kindk12 in forum AWT / Java Swing
    Replies: 2
    Last Post: June 23rd, 2012, 03:36 AM
  3. Kindly Review My Code :-) Thanks in advance
    By bhuppi in forum What's Wrong With My Code?
    Replies: 1
    Last Post: April 27th, 2012, 10:10 AM
  4. Pls guide me in advance java
    By deepaks50 in forum Java Theory & Questions
    Replies: 3
    Last Post: May 19th, 2011, 08:55 AM
  5. Help with looping etc THANKS ALOT IN ADVANCE
    By moesom in forum What's Wrong With My Code?
    Replies: 3
    Last Post: April 15th, 2011, 10:43 AM