<%@ page import="java.sql.*,
                 java.util.Properties" %>
<%
  // Get the path to the database
  Properties conf = new Properties();
  conf.load(this.getClass().getResourceAsStream("/config.properties"));
  String fileroot = conf.getProperty("DBFileRoot");

  // Retrieve the database connection
  Class.forName("org.hsqldb.jdbcDriver");
  Connection c =
    DriverManager.getConnection ("jdbc:hsqldb:" + fileroot + "TriviaDB", "sa", "");
  c.setAutoCommit(false);

  Statement query = c.createStatement();
%>

<html>
<body>

<p>The current database content:

<pre>
<%
  ResultSet rs = query.executeQuery ("Select * from Questions");
  while (rs.next()) {
%>
<%=rs.getInt(1)%> <%=rs.getString(2)%> <%=rs.getString(3)%> <%=rs.getInt(4)%> <%=rs.getInt(5)%> <%=rs.getInt(6)%>
<%
  }
  rs = query.executeQuery ("Select * from Choices");
  while (rs.next()) {
%>
<%=rs.getInt(1)%> <%=rs.getInt(2)%> <%=rs.getInt(3)%> <%=rs.getString(4)%>
<%
  }
  rs.close();
  c.close();
%>
</pre>
</body>
</html>