Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ResultSet to Array

 
Srinivasa Maddi
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can i convert a ResultSet to an array of String values. I tried the following
 
Shailesh Chandra
Ranch Hand
Posts: 1082
Java Oracle Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the datatype of column, which you are expecting to retrieve as array ?

Shailesh
 
Srinivasa Maddi
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
String
 
Shailesh Chandra
Ranch Hand
Posts: 1082
Java Oracle Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not sure but probably you are looking for this.



Shailesh
 
steve souza
Ranch Hand
Posts: 862
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
'getString' returns a String and you are assigning it to an ayrray. You should allocate a String[] array for each and loop through it for the columns, assigning the string to the different elements of the array.
 
Srinivasa Maddi
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you all for responding
 
Jack Bolton
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Shailesh Chandra wrote:I am not sure but probably you are looking for this.



Shailesh


with this code, the options array has all the values from the resultset.

but if i do this:



i got:

null
1
null

when in fact it should be the values from the database that the resultset had.

whats going on here?>
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic