public void alterar(Veiculo v) {
    {
      try {
        Connection con = DatabaseConnection.getConnection();

        StringBuffer sb = new StringBuffer();
        sb.append(
            "UPDATE tb_veiculo SET chassi = ?, marca = ?, modelo = ?, anofabricacao = ?, anomodelo = ?, carroceria = ?, ");
        sb.append("capacidadecarga = ?, status = ? ");
        sb.append("WHERE placa = ?");

        PreparedStatement st = con.prepareStatement(sb.toString());
        st.setString(1, v.getChassi());
        st.setString(2, v.getMarca());
        st.setString(3, v.getModelo());
        st.setInt(4, v.getAnoFabricacao());
        st.setInt(5, v.getAnoModelo());
        st.setString(6, v.getCarroceria());
        st.setInt(7, v.getCapacidadeCarga());
        st.setString(8, v.getStatus());
        st.setString(9, v.getPlaca());

        st.executeUpdate();
        con.close();
      } catch (ClassNotFoundException e) {
        e.printStackTrace();
      } catch (SQLException e) {
        e.printStackTrace();
      }
    }
  }
  public void adicionar(Veiculo v) {
    try {
      Connection con = DatabaseConnection.getConnection();
      StringBuffer sb = new StringBuffer();
      sb.append(
          "INSERT INTO tb_veiculo (placa, chassi, marca, modelo, anofabricacao, anomodelo, carroceria, ");
      sb.append("capacidadecarga, status )");
      sb.append("VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)");

      PreparedStatement st = con.prepareStatement(sb.toString());
      st.setString(1, v.getPlaca());
      st.setString(2, v.getChassi());
      st.setString(3, v.getMarca());
      st.setString(4, v.getModelo());
      st.setInt(5, v.getAnoFabricacao());
      st.setInt(6, v.getAnoModelo());
      st.setString(7, v.getCarroceria());
      st.setInt(8, v.getCapacidadeCarga());
      st.setString(9, v.getStatus());
      st.executeUpdate();
      con.close();
    } catch (ClassNotFoundException e) {
      e.printStackTrace();
    } catch (SQLException e) {
      e.printStackTrace();
    }
  }
 public void remover(Veiculo v) {
   try {
     Connection con = DatabaseConnection.getConnection();
     String sql = "DELETE FROM tb_veiculo WHERE placa = ?";
     PreparedStatement st = con.prepareStatement(sql);
     st.setString(1, v.getPlaca());
     st.executeUpdate();
     con.close();
   } catch (ClassNotFoundException e) {
     e.printStackTrace();
   } catch (SQLException e) {
     e.printStackTrace();
   }
 }