Little Child Little Child - 1 year ago 119
Java Question

Send a ResultSet over Socket

I am trying to create a distributed system in which the GUI will reside on a clerk's PC and the

.mdb
will reside on another PC which will act as the server.

I want to know how I can send a query from the client to the server and retrieve the
ResultSet
and populate a
JTable
on the client GUI using Socket

Initial Thoughts



I initially thought of using
GSON
to send data from client to server and vice versia but do not know how to and if it will be the right approach?

Answer Source

You can't send ResultSet object accross network using Socket because ResultSet does not implements Serializable. If you want to populate the JTable with the results obtained from ResultSet you should first retrieve the results from it and store in and ArrayList or any other Collection suitable for you and then send the object of that Collection accross network to other end via Socket.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download