> Thanks, I noticed that...
> I just cannot find a way to get Map type results.
> Maybe I had too many beers at my summer vacation...
>
> -Event
> while (rset.next) {
Sorry...that should be
while (rset.next()) {
HightowerC
"HightowerC" <chris.hightower@gmail.com> kirjoitti
viestissä:1183390198.464448.132440@k79g2000hse.googlegroups.com...
>> -Event
>
[quoted text clipped - 5 lines]
> }
> return retmapFile;
Thanks again,
That's exactly what I tried earlier today, but I think my problem was
adding stuff to Map. I'm completely newbie with Java :(
Could you maybe show me the syntax to do that?
I tried to Google but no help....
Thanks in advanced,
-Event
HightowerC - 02 Jul 2007 21:58 GMT
> Could you maybe show me the syntax to do that?
> I tried to Google but no help....
>
> Thanks in advanced,
>
> -Event
Well, I'm not very experienced in Java either, but as I understand it,
Map is an interface.
You will have to instantiate a class that implements Map (such as
HashMap).
Do you really need an array of Map objects, or do you just want 1 Map
object that contains data returned by the Query?
If you only need 1 map object containing data, then look at the
JavaDocs for the HashMap class, and specifically the .put(K key, V
value) method.
If you need an array of Map objects, then create a new map on each
iteration and then add this Map object into the array. (Note that you
will have to set the size of the array beforehand, and you may not
know exactly how many elements will be returned from the database via
the Query).
BTW, I'm not sure that HashMap is the best choice for this situation.
I don't know a whole lot about the different collections in Java.
Maybe someone else in the NG can point out a better solution.
HightowerC