Create global database instance if this is executed in dev context
Make sure to catch all kinds of exceptions