<%@ page import="java.io.*, java.lang.*, java.sql.*" %> <%! // Declarations String dayID, dayName; StringBuffer sites; %> <% Connection con; Statement s; ResultSet rs; String line, desc; try { // Establish database connection Class.forName("com.mysql.jdbc.Driver"); con = DriverManager.getConnection( "jdbc:mysql://localhost/phos", "cklutzke", "periadon"); s = con.createStatement(); // Determine day dayID = request.getParameter("dayID"); if (dayID == null) { dayID = "0"; } // Get the day name from the database. rs = s.executeQuery("SELECT d.name FROM day AS d " + "WHERE d.dayId = '" + dayID + "'"); while (rs.next()) { dayName = rs.getString("d.name"); } rs.close(); // Get the site list from the database. sites = new StringBuffer("

Sites

"); s.close(); con.close(); } catch (ClassNotFoundException e1) { // JDBC driver class not found, print error message to the console out.println(e1.toString()); } catch (SQLException e2) { // Exception when executing java.sql related commands, print error message to the console out.println(e2.toString()); } catch (Exception e3) { // other unexpected exception, print error message to the console out.println(e3.toString()); } %> Carl's Link Database: <%= dayName %>

<%= dayName %>

LinkDb

<%= sites %>