package process;

import java.sql.*;
import javax.servlet.http.*;

public class process {
        private int attempts = 0;
        String texto;
  String blabla;
  Statement stmt;
  Connection con;

  public ResultSet processRequest(HttpServletRequest request) {

    try {
                        Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

                } catch(java.lang.ClassNotFoundException e) {
                        texto = "Erro ao tentar identificar o driver";
                }

                try {
                        con = DriverManager.getConnection("jdbc:odbc:CafeJava");

                        String query = "select * from coffees where COF_NAME='" + request.getParameter("blabla") + "'";
                        stmt = con.createStatement();
                ResultSet res = stmt.executeQuery(query);

                stmt.close();
                        con.close();

                        return(res);

                } catch(SQLException ex) {
                                texto = ex.getMessage();
                                return(null);
                }

        }

        public void setAttempts(int value) {
        attempts = value;
    }

    public String getString() {
return texto;
    }

    public int getAttempts() {
        return attempts;
    }

}