db connection bottleneck
from each db connection, i want to maximize the amout of data
extracted. currently
(machine #1): make db connection. read some data. create "object". send to machine #2.
(machine #2): receive "object".make a db connection, read some data.
i know the query that machine #2 will make before sending the object from machine #1.
i can't just have one ArrayList of values because different quries will have different # of columns with different types, (Double) or two columns (Double, String) or (Integer, Double, Double), etc. etc.
i can't serialize the db connection, so the data must be gotten on machine #1, then bundled-up for transmission over the socket.
what is a good solution?
PipedInputStream rcv_data =new PipedInputStream();
PipedOutputStream send_data =new PipedOutputStream(rcv_data);
LoadData loadData =new LoadData(send_data, query);
loadData.start();
ObjectInputStream rcv_data_ois =new ObjectInputStream(rcv_data);
while(loadData.isAlive()){
if(rcv_data.available() > 4){
String item = (String) rcv_data_ois.readObject();
String host = (String) ServerFinder.getServer();
Socket sok =new Socket(host, 5508);
ObjectOutputStream sok_oos =new ObjectOutputStream(sok.getOutputStream());
MyObj obj =new MyObj(item, query_made_on_machine2);
sok_oos.writeObject(obj);
}
.....
}// __while(loadData.isAlive())__
on machine #2, i start another
LoadData loadData =new LoadData(send_data, query_made_on_machine2);
loadData.start();
.....
thanks.

