Hey guys,

Not new to JDBC but probably to 'proper' JDBC use.

Basically I have an app that when invoked, is required to produce an output file of records from various tables. It needs to 'somehow' get a list of all the records in table A and then for each record it finds, check tables B and C and retrieve the equivilant data. Some business logic is applied and an output record is written.

My trouble comes from how to actually set this up in a decent OO design. I am connecting to a DB2 database through the typical conection driver way. I have a single class right now acting as the DataAccess class (conn, insert, update, select prepared statements, conn close, etc) and a few others for the business logic and some data storage classes to represent the retrieved records from tables A, B and C.

What I get stuck with is the 'best' way to get this listing of all records from table A and then based on that, start checking the other tables. Originally I had the business class(es) create a db conn, then call a 'get record count' or 'get all id's' from table A method which would return a Vector or Array (whatever) with all the ids i needed. And based on that, start a for-loop thru them and get the data from the other tables.

I don't know if this is right or not - should i move the business logic of comparing the records from tables A, B and C into the DataAccess class where i have my open ResultSets easily accessable? I am trying to do this with as few connections as possible.

If anyone has a link to a methodolog that describes this sort of deal could you please post it?