When you're experiencing difficulties with prints sticking to the build plate, there could be a few things going on. It could either mean that the first layer just doesn't stick well enough or that the prints gets loose due to "warping" of the plastic. Warping basically happens because of the properties of the plastic. Plastics have the tendency to shrink when cooling down fast (some plastics more than others), which could eventually lead to your print curling up (at the corners). You will especially notice this behaviour when printing ABS, which has a relatively big shrinkage.
There are a few things you could do for a good first layer of a print and to reduce the amount of warping.
Heated bed temperature
With a heated bed, using the correct bed temperature is important for good adhesion. This way you ensure that the first layer of the print doesn't cool too much, due to which it could shrink a lot. A temperature of 60°C is recommend for PLA while ABS needs a temperature of 90°C. The default settings on the Ultimaker 2 should be fine for this, but you can always play a bit around with it.
For printing it is very important that the first layer is nicely squished into the glass plate and sticks well to it. If the distance between the nozzle and build plate is too big, your print won’t stick properly to the glass plate. On the other hand, if the nozzle is too close to the build plate it can prevent the filament from extruding from the nozzle.
In both cases this will lead to a bad first layer, which might eventually lead to adhesion problems. Make sure to re-level the build plate if you're experiencing this issue.
For good adhesion it is important that the glass plate is either completely clean or that glue is applied to the glass plate. For PLA it's not necessary to use glue, although it's recommended when printing bigger objects. When using ABS, it's advised to always have a thin layer of glue on the glass plate.
Using a "Brim"
A nice feature in Cura to help preventing warping is called "Brim". It will place a single layer thick flat area around your object, thus creating a bigger adhesion surface. The Brim can easily be removed once the print has finished.
This option can be selected when using the Full settings in Cura. You can find it at "platform adhesion type" in the basic settings tab.