Java can access MySQL over TCP ... no browser API for JavaScript allows TCP, so JavaScript is not an option, except serverside JavaScript ... if you really want to have a direct connection, Java will probably be your choice ... you can create a Java applet, which will connect to the remote MySQL daemon, using ... you may have to sign it though, in case the default sandbox does not allow this kind of communication ...
alternatively, you could use FlashPlayer 9+, in theory, but you'd have to implement the whole protocol in ActionScript 3 or haXe, so that's not so much of an option I guess ...
however, the 3 tier design you don't want, is really the best way to go, due to several reasons:
- flexibility: if you introduce an extra layer between the client and the database, this gives you more power for later modifications and decouples client and DB ...
- control: it is much easier to control/restrict access to the database
- security: typically, you'd configure your MySQL DB, so that it will only accept connections from very few hosts, usually only localhost, and maybe one external server ... this way, the security of your DB practically is the security of the external server, since probably noone else even knows the DB ... I wouldn't say it's easy to secure a server ... but it's more secure than if you have numerous public accounts, that may access the DB from any host, over unsecure connections ...
greetz
back2dos