This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
The applet may or may not be able to connect to the database depending on the constraints placed on the applet by the browser. The actual method is the same as for your application. If you get a security exception then the browser is preventing you from reaching the database. You may want to think about setting up a servlet to act as a proxy for the applet.