what's the best architecture for connecting to some remote mysqlserver (database) from java swing stand alone client application on the internet without needing middle server

If you wish to connect from standalone application shifts then JDBC is most effective.

You generally don't want to reveal your database directly to the web. IMHO you need to really consider placing a (web or application) server among. If you wish to or need to, however, you need to put real effort into acquiring it: quite strong passwords, very limited permissions on everything, using SSL with client certificates or even even establishing a VPN ... Than the diminishes an issue of programming than configuration and serverfault is a great place to obtain more information.

I discovered two interesting related questions about Serverfault that cope with this problem (not MySQL though):

  1. The wisdom of exposing a database server on the internet?
  2. How to expose SQL 2008 database to the world through the Internet?

From an architecture perspective, despite a thick client I would rather possess a web server among that utilizes Cleaning soap or Relaxation to supply database functionality towards the client application.

JDBC will be the best

  String url = "jdbc:mysql://HOST/DATABASE";
  conn = DriverManager.getConnection(url, "username", "password");

This is a assortment of connectionstring to make use of on different databases


You'll certainly wish to acquaint yourself with concurrency issues in Swing, in addition to constructs such as the SwingWorker and SwingUtitlies.invokeLater (see link below). Making remote calls from inside the EventDispatchThread will hang your GUI and supply a really bad experience for your customers.