Initial commit for Git.

This commit is contained in:
Erik C. Thauvin 2012-05-14 13:37:38 -07:00
parent 98b1521e20
commit 9595f70fd7
27 changed files with 1790 additions and 1780 deletions

View file

@ -1,45 +1,45 @@
<%@page import="javax.naming.*, javax.sql.*, java.sql.*;" %>
<html>
<head>
<title>SimplePool JNDI Example</title>
<%@page import="javax.naming.*, javax.sql.*, java.sql.*;" %>
<html>
<head>
<title>SimplePool JNDI Example</title>
</head>
<body>
<%
// Get a new initial JNDI context
Context ctx = new InitialContext();
<body>
<%
// Get a new initial JNDI context
Context ctx = new InitialContext();
// Get a reference to our JNDI DataSource
DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/JNDIPoolDS");
// 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");
%>
DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/JNDIPoolDS");
// 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");
%>
<h3>Tables</h3>
<ul>
<%
// Loop through the result set and
// display the current column value
while (rst.next()) {
%>
<li><%= rst.getString(1) %></li>
<%
}
%>
<ul>
<%
// Close the result set, statement and connection
rst.close();
stmt.close();
conn.close();
%>
<ul>
<%
// Loop through the result set and
// display the current column value
while (rst.next()) {
%>
<li><%= rst.getString(1) %></li>
<%
}
%>
<ul>
<%
// Close the result set, statement and connection
rst.close();
stmt.close();
conn.close();
%>
</body>
</html>