// Programm 7-5f: BSP_ROOT/meinewebapp/WEB-INF/classes/muster/GaestebuchListe.java
package muster;
import java.sql.*;

public class GaestebuchListe {
  ResultSet rs;
  public Object setListe() {
    try {
      Class.forName("org.gjt.mm.mysql.Driver"); 
      Connection c = DriverManager.getConnection("jdbc:mysql://localhost:3306/jdbcbuch");
      Statement s = c.createStatement();
      rs = s.executeQuery("SELECT * FROM Gaestebuch");
      return rs;
    }
    catch (Exception ex) { return null; }
  }
  public Object getListe() {
    Object tmp = "";
    try { 
      if (rs.next()) {
        tmp = rs.getString("gnr") + "; " + rs.getString("motto");
        return tmp; 
      }
      else return null;
    }
    catch (Exception ex) { return null; }
  }
}