<%@ taglib uri="http://jakarta.apache.org/taglibs/dbtags" prefix="sql" %>

Opening connection

<%=request.getParameter("jndiname")%>

Connection is closed?

Deleteing the results of the last test

delete from test_books where id > 2

Showing current contents of the "test_books" table

select id, name, description from test_books order by 1
idnamedescription
[no description]

Inseting a row using the "statement" tag

insert into test_books (id, name) values (3, 'Gravity's Rainbow')

Showing current contents of the "test_books" table

select id, name, description from test_books order by 1
idnamedescription
[no description]

Selecting back the title of book 3, assigning the value to an attribute

select name from test_books where id = 3 order by 1

Inserting that title into a new row with a "preparedStatement" tag, adding a description

insert into test_books (id, name, description) values (?, ?, ?) The contents of an execute body are not included in the output 4 <%=pageContext.getAttribute("bookName")%> book by Pynchon

Showing current contents of the "test_books" table

select id, name, description from test_books order by 1
idnamedescription
Description: <%= pageContext.getAttribute("description") %> [no description]

For fun, pretend that the ids are British money

select id from test_books order by 1

Closing the database connection

Connection is closed?

Success!