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 ...

Get MySQL™ and JSP™ Web Applications: Data-Driven Programming Using Tomcat and MySQL now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.