private void validateAdd(RentalSchema p) {
   // TODO: Aqui se anade la data a la tabla de RentMovie
   try {
     String query =
         "INSERT INTO rentmovie (MoviesID, CustomersID, Rented, RentedOn, ReturnedOn)"
             + "VALUES (?, ?, ?, ?, ?)";
     ////////////
     Class.forName("com.mysql.jdbc.Driver"); // MySQL database connection
     Connection conn =
         (Connection)
             DriverManager.getConnection(
                 "jdbc:mysql://us-cdbr-azure-east-a.cloudapp.net:3306/movierental?"
                     + "user=b80812adafee28&password=5b6f9d25");
     PreparedStatement pst = (PreparedStatement) conn.prepareStatement(query);
     //////////////////////////////
     pst.setInt(1, p.getMoviesId());
     pst.setInt(2, p.getCustomersId());
     pst.setBoolean(3, true);
     pst.setString(4, p.getRentedOn());
     pst.setString(5, "Not yet Returned!");
     JOptionPane.showMessageDialog(null, "Data was saved sccessfully");
     pst.executeUpdate();
     conn.close();
   } catch (ClassNotFoundException | SQLException e) {
     JOptionPane.showMessageDialog(
         null, "There was some problem with the connection. Please try again!");
     e.printStackTrace();
   }
 }
  private void jButton1ActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_jButton1ActionPerformed
    // TODO add your handling code here:
    if (movieId.getText().length() == 0) {
      movieIdError.setText("* Field is mandatory");
    } else if (customerId.getText().length() == 0) {
      customerIdError.setText("* Field is mandatory");
    }
    RentalSchema r = new RentalSchema();
    DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd");
    Date date = new Date();
    r.setCustomersId(parseInt(customerId.getText()));
    r.setMoviesId(parseInt(movieId.getText()));
    r.setRentedOn(dateFormat.format(date));

    validateAdd(r);
  } // GEN-LAST:event_jButton1ActionPerformed