O'Reilly logo

MySQL™ and JSP™ Web Applications: Data-Driven Programming Using Tomcat and MySQL by James Turner

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using Turbine Connection Pooling

Using the connection-pooling code is a pretty simple affair, as shown by the sample program in Listing 7.6.

Listing 7.6. DBPool.jsp
 <%@ page import="org.apache.turbine.util.TurbineConfig" %> <%@ page import="org.apache.turbine.services.db.TurbineDB" %> <%@ page import="org.apache.turbine.util.db.pool.DBConnection" %> <%@ page import="java.sql.*" %> <%@ page import="org.apache.turbine.util.Log" %> <HTML> <HEAD> <TITLE>A JDBC SmokeTest</TITLE> </HEAD> <BODY> This is a smoketest <% DBConnection dbConn = TurbineDB.getConnection(); PreparedStatement pstmt = dbConn.prepareStatement("select * from Customer"); ResultSet rs = pstmt.executeQuery(); if (rs.next()) { out.print("Got a result set!"); } else { out.print("No ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required