Beispiel #1
0
  public boolean cadastrar(Fabricante fab) throws SQLException {

    Connection con = null;
    PreparedStatement st = null;

    try {

      con = ConexaoDAO.getConnection();
      st = con.prepareStatement("INSERT INTO fabricante (nome,material) VALUES(?,?)");
      st.setString(1, fab.getNome());
      st.setString(2, fab.getMaterial());
      ;
      return st.execute();

    } catch (Exception e) {

      // e.printStackTrace();
      st.close();
      con.close();
      return false;
    }
  }