• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

resultset into 2d array

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
Im looking for the fastest, most efficient way to parse a resultSet into a 2D array. Due to the structure of my program a 2D array is the preferable data structure, i dont want to use a map or a list.

Could anyone please point me to a simple way to parse a resultSet into a 2D array ?

Thanks
 
Marshal
Posts: 70327
283
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no such thing as a 2D array, only an array of arrays.

Your result set consists of n results, but you would have to count them first probably with the next() method. Then you would have to go back, and your results in each row would be different type, so unsuitable for an array of arrays. You could more easily create an array of FooResult objects. I am surprised you think a Foo[][] is a suitable data structure for a ResultSet.
 
I have gone to look for myself. If I should return before I get back, keep me here with this tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic