Help on accessing data

I have 4 rows returned from a query. This returns 4 employees belonging to a company and companynum is unique. I'm using jdbc to retrieve the data and writing to a xml file. Right now, i'm able to get only the first row from jdbc resultset. Look at the xml file below to understand the structure that i want in xml.

How can i access the address2 info when the employee has more than one address? Should i use vector or iterator?

How can i get the data for other rows i.e employee2, employee3, employee4 using java? Should i use vector or an iterator?

<xml>

<companynum>

<employee1>

<firstname>

<lastname>

<address1>

<city>

<state>

</address1>

<address2>

<city>

<state>

</address2>

</employee1>

<employee2>

<firstname>

<lastname>

<address1>

<city>

<state>

</address1>

<address2>

<city>

<state>

</address2>

</employee2>

<employee3>

...

....

...

<employee4>

[1232 byte] By [deepa1a] at [2007-10-3 2:20:05]
# 1

> I have 4 rows returned from a query. This returns 4

> employees belonging to a company and companynum is

> unique. I'm using jdbc to retrieve the data and

> writing to a xml file. Right now, i'm able to get

> only the first row from jdbc resultset.

So how are you accessing your Resultset? Are you ever calling the next method to get to the next row?

tsitha at 2007-7-14 19:18:59 > top of Java-index,Java Essentials,New To Java...
# 2
Yes, I'm using rs.next(). I got the data from first row but how can I access the second row? Should i use Vector/iterator to iterate through and get the next row?if(rs.next()){rs.getString("Firstname");:::}
deepa1a at 2007-7-14 19:18:59 > top of Java-index,Java Essentials,New To Java...