The way you should connect with a database from a servlet i sthe same as you should from just about any Java program :- using the JDBC (Java Database Connectivity API) API. WIth that in mind, I'v emoved this post over to our JDBC forum, where you will probably get more useful answers.
Using java DataSources is the standard way. I have a generic DataAccess class available as part of the FormattedDataSet that abstracts using standard jdbc connections and DataSource connections, so your code will work the same in both cases. The DataAccess classes are also monitored for performance and come with a method that converts ResultSets to Object (wrapped in the ResultSetConverter object). This approach allows my code to make all your jdbc calls (i.e. opening, closing connections, statements, ResultSets). A live demo and javadocs are available at http://www.fdsapi.com. In the javadocs look at DataAccess, DataAccessBase, DataAccessClient, and DataAccessJ2EE.