public Form getForm(int formId) throws FormNotFoundException, ErrorRecreatingFormException {
        try {
            String q = "select formobject from form where formid = ?";
            PreparedStatement st = conn.prepareStatement(q);
            st.setInt(1, formId);
            ResultSet rs = st.executeQuery();
            conn.commit();
            Form f;
            rs.next();
            byte[] buf = rs.getBytes(1);
            ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(buf));
            return (Form) in.readObject();
        }
        catch(SQLException e) {
            e.printStackTrace();
            throw new FormNotFoundException("Form does not exist");
        }

        catch(IOException e2) {
            e2.printStackTrace();
            throw new FormNotFoundException("IO Exception when retreiving form");
        }
        catch (ClassNotFoundException e3) {
            e3.printStackTrace();
            throw new ErrorRecreatingFormException("Error recreating form response");
        }
    }