This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Please use the code button; I have edited your post so you can see how much better it would look. Please tell us all the details, including which line you get the Exception on.
Are you sure that every element in the rows is a String? If you write rs.getString(i + 1), what if that column was declared as INT or DECIMAL?
Joined: Nov 19, 2008
hi, One of the column is char(1) datatype.
Joined: Oct 13, 2005
You will have to check whether char(1) comes out as a char or a String; I don't know.
There are methods in the ResultSetMetaData interface which get the type of a column. Maybe getColumnType(). Try that on the three columns and see what prints out. Also go to the Types class and see what the different numbers mean. If you hunt through the Types class you will probably find fields like STRING and INT and LONG; against them you will see a link which reads something like "constant values." If you click that link you can find out what the different numbers are.
I don't know whether that will sort out your problem, but it is worth trying.
The Java collection classes don't allow modifying the collection while you're iterating through it. You'll have to find some other way to do this - for example, add the elements to a temporary list which you add to aList after the loop, or something similar.
What type of elements are you getting in your aList? Are these of String type? Check it.
Secondly, Can you tell me what purpose will it solve by adding the last element of RHistory in your list. You are adding elements outside the loop. [ November 21, 2008: Message edited by: Patricia Samuel ]
Joined: Nov 19, 2008
now its working fine.
Thanks a lot for all your expert comments.
Joined: Sep 12, 2007
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com