Tomcat has the ability to construct resource object and make them locatable via JNDI. I've used this for a lot of things, but one of the most common is a database connection pool. Tomcat comes with a copy of the Apache DBCP pooler, although if you prefer, you can plug in other poolers.
For details on how to construct and configure a pool, check out Tomcat's documentation. I think it includes an example for MySQL.
Once the pool has been created, the webapp can use JNDI to locate it - for example as "java:/comp/env/jdbc/datasource1". Any Java class can do a JNDI lookup and get a connection from that pool, and since JSPs compile into servlets and servlets are java classes...
Personally, I don't recommend putting logic on JSPs. They can very swiftly become real maintenance nightmares. However, if you must, there are some JSP tags that will help. I think the JSTL tagset includes some, as a matter of fact.
Customer surveys are for companies who didn't pay proper attention to begin with.
subject: Configuring mySQL database connectivity in tomcat's server.xml