Database: Keys located in the database can be found by anyone with access to the database or by Jira Admins with scripting experience. That is why this method is more vulnerable. Instead, the positive point is that the keys keeps in the database and can be backed up or restored.
Memory: Keys located in the memory are much more difficult to find than those located in the database. Another important aspect is that memory keys are volatile. That is, as the memory is cleaned when you stop your Jira instance the keys are cleaned too, so the administrator has to enter them again every time Jira is started. Obviously, memory keys are not exported and can not be restored automatically.