I have a client and a server - the client sends the server a message, and depending on what message is sent, the server will perform an action and then reply to the client.

Most of the actions that I have implemented are working.

I need help with one of the actions though - The client will send the server a request.

The server has to query a database and then return the results to the client.

Is it possible to send a resultset from the server to the client?

If so, what function will I use, and if not, what is the best way to send the information back to the client?

You can use an ObjectOutputStrem / ObjectInputStream via you sockets to send a set of results. If all the calsses & subclasses are serialisable that simply works. If not, extract the data into something that is serialisable and send those.

A ResultSet is tied to a Statement which is tied to a Connection. If you close the Statement or Connection, you impact the ResultSet. It is ideal to take the ResultSet on the server and place it into a different object and then pass that new object to the client. This lets the server quickly free up the database resources for the next action/query.

You may want to look at DynaBeans (Apache project)

This question has already been answered. Start a new discussion instead.