Maybe the User Account that launches the task does not have permissions to open the database (particularly if it is SQL)