<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1" import="java.sql.*"%>
<%
	Connection conn = null;
	PreparedStatement stmt = null;
	ResultSet rs = null;
	try
	{
		Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
		conn = DriverManager.getConnection("jdbc:odbc:Presidents");
		
		String sql = "SELECT Bio FROM Presidents WHERE PresidentID=?";
		stmt = conn.prepareStatement(sql);
		stmt.setString(1, request.getParameter("id"));
		
		rs = stmt.executeQuery();
		if (rs.next())
		{
			out.write(rs.getString("Bio"));
		}
		else
		{
			out.write("No president selected");
		}
	}
	catch (Exception e)
	{
		out.write(e.toString());
	}
	finally 
	{
		if (rs != null) rs.close();
		if (stmt != null) stmt.close();
		if (conn != null) conn.close();
	}
%>