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(); } }