JSP page using JDBC in a scriptlet

<jsp:directive.page import="java.sql.*" /><br /><span class="boldcode"><jsp:scriptlet><br />Class.forName("org.gjt.mm.mysql.Driver");<br />Connection connection = <br />    DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "", "");<br />Statement statement = connection.createStatement();<br />int changed = <br />    statement.executeUpdate("update counters set hitCount = hitCount + 1 " +<br />                "where page like '" + request.getRequestURI() + "'");<br />if (changed == 0) statement.executeUpdate("insert counters(page) values('" +<br />                       request.getRequestURI() + "')");<br />ResultSet rs =<br />    statement.executeQuery("select hitCount from counters where page like '" +<br />                request.getRequestURI() + "'");<br />rs.next();<br />int hitCount = rs.getInt(1);<br />statement.close();<br />connection.close();<br /></jsp:scriptlet></span><br /><br /><HTML><br /><HEAD><br /><TITLE>JDBC scriptlet example</TITLE><br /></HEAD><br /><BODY><br /><br /><P>This page has been hit <br /><span class="boldcode"><jsp:expression>hitCount</jsp:expression></span><br />times. The page counter is implemented by a JSP scriptlet calling<br />the JDBC package directly.</P><br /><br /></BODY><br /></HTML><br />