Use jrdc2. Haven't tried using localhost on the client but localhost works fine in jrdc2 if the jrdc2 is on the same computer as the DB but don't forget it must be a fixed IP if you use the IP Addr. Otherwise the connection may be lost on reboot.
I present the user with a dialog to type the ip addr. It starts out looking like this: "192.168.?.?".
For the port I have 10 ports in the jrdc2 config file, one of which I unrem to use. The client gets a dropdown list of those 10 ports, there is also a button to try them all. This way all the user really has to know is the ip addr.
Now all of this is, for us always running on a LAN. Never internet which I have yet to try. Over a LANI have found speed is just not an issue.
If you have multiple user on the same DB, as we do, the other thing I did is add QR code get/set buttons so a new user can download the app, point his device at the QR code from an already connected device, and bang, he is in.