Is there any specific reason of using the whole image in to database?
The reason behind asking this is simply because I think storing NSData in database is storing a lot of data in the database, which on a longer run can make your database really heavy.
Better option is to save the image in Documents Directory or may be Library directory for that matter and then simply saving the full image path of the image in your database.
Then simply which retrieving it in an imageView you need to call
UIImageView *imgView = [UIImageView setImage:[[UIImage alloc] initWithContentsOfFile:filePath]];
Here all you need to pass is "filePath" which you have fetched from database.
Hope this helps you.