You might want to take a look at
this thread that I posted about 2 years ago. I was able to run an applet that accessed a MySQL DB on the same server as the web server.
Ernest is correct with what he says. That is the
proper way to do it, but if you need to get by, it can be done.
On that note, I would second guess the need for an applet. Unless you have need for some pretty fancy GUI elements or this is for a class and an Applet is required, I would definatly look into a Web Application design instead of an Applet.