Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem geting column value.

 
Em Aiy
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Please look at the following code



This code is throwing exception ... "array index out of range". I have checked it and it comes only when i use rs (resultset object) to retrieve the value.
 
Herman Schelti
Ranch Hand
Posts: 387
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Muhammad Ali,

I think int i should start with the value 1 (not with 0):

the JavaDoc for ResultSetMetaData says:
column - the first column is 1, the second is 2, ...

Herman
 
Em Aiy
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yeah, one possible reason was that. The other reason was, i must have done "rs.next()" in order to get a value from the record.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic