%@page import="javax.naming.*, javax.sql.*, java.sql.*;" %>
SimplePool Servlet Example
<%
// Get a reference to our DataSource
DataSource ds = (DataSource) pageContext.findAttribute("ServletPoolDS");
// Get a connection from the pool
Connection conn = ds.getConnection();
// Create a new statement
Statement stmt = conn.createStatement();
// Execute the query
ResultSet rst = stmt.executeQuery("SHOW TABLES");
%>
Tables
<%
// Loop through the result set and
// display the current column value
while (rst.next()) {
%>
- <%= rst.getString(1) %>
<%
}
%>
<%
// Close the result set, statement and connection
// and display the current column value
rst.close();
stmt.close();
conn.close();
%>