Java – Accessing a remote server from desktop application

cjavaserver

Web applications (.jsp / Java) have the advantage that they can be run from any client browser by putting a single URL into the address bar, and off you go.
However, the average web application is slow, clunky, and maintaining the code behind it is hell on earth.

Conversely, a typical desktop application (Java / c#) can have a slick interface, snappy response, and the code behind it is often much neater, compartmentalised, and often a pleasure to work with.

Is there a way or technique to connect to a remote server through a Java / c# desktop application, that can be distributed to any Windows computer, that doesn't first require the computer to connect to the remote server through a VPN, as a separate user procedure? (Usernames /passwords / connection details will obviously need to be stored in a config file associated with the application).

The remote server would be hosting a 'communal'(?) SQLServer database, and I suppose, possibly some files.

Best Answer

Yes you can.

You can set up a webservices API that connects to your database, thus keeping the database connection secure and wholly within your network. This is instead of the web server that would normally serve the web site to the users.

The desktop clients then connect to the webservices to communicate with the database. You could have the standard CRUD methods for your objects or you could wrap them up in more intelligent layers that do validation and verification of the data.

You just need to publish the desktop client installer on the web somewhere where everyone (or where at least those you want access) can see it. You can prevent unauthorised access quite easily - you either generate the user accounts and mail out the details or you vet the requests for access as they come in.

You can even make the application self updating so that the user is always on the latest version.