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.

1 Answer 1


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.

  • Thanks, I'll investigate "webservices API" - I wasn't aware of this functionality. I'll do anything to avoid writing an application using html/ .jsp's !
    – user4109
    May 10, 2014 at 16:59
  • Umm, I've investigated, and it's not quite like how I hoped. I've used SOAP type services before, and that turned out to be a week of frustration. In contrast, connecting to a remote database after establishing a VPN to that remote database was so simple and straightforward. Some way of 'automating' the VPN connection was what I was hoping for.
    – user4109
    May 10, 2014 at 17:31
  • @user4109 Web services are quite straightforward - at least they are with C# & .NET. You make a direct connection and get the actual objects back.
    – ChrisF
    May 10, 2014 at 17:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.