You do it pretty much the same way you'd do it through any other
java program. The most common way in my experience is to use
jdbc to get access to a connection pool that has been set up on the application server you're running. Normally you'll want to do this either in you action class or in a class called by your action class. Try looking for information and examples on how to use jdbc in conjunction with your app server. Here's an example of a page that explains how to use jdbc with a glassfish application server:
glassfish jdbc resource