raberana
raberana

Reputation: 11816

SSIS OnError event handler not firing on failed database connection

I created an SSIS package with an OnError event handler that inserts some log record on a database.

When I run the package via a batch file, I see in my batch file log that the package failed to execute because the connection to a database (different from the DB where I insert the error logs) fails. However, there is no inserted log record (meaning the OnError event handler did not fire?)

Are OnError event handlers not firing when connection to a DB fails?

Upvotes: 0

Views: 4569

Answers (2)

raberana
raberana

Reputation: 11816

Found it. The DelayValidation property of the whole package must be set to True in order for the validation of connection managers (and other things i think) to be not executed until run time

OnError event handler is not fired because it only works on run time. However, a pre-validation happens before runtime and the package fails when the pre-validation sees that one of the connection to DB is not working

Upvotes: 5

BIDeveloper
BIDeveloper

Reputation: 2638

  1. Are you sure that your connection to the Error Logging database is valid. You could try writing elsewhere to prove that it is OK - text file?
  2. Add some code to the OnTaskFailed event in case you are not reaching the OnError event.
  3. Have FailPackageOnFailure set to True

Although you may not want to leave steps 2 and 3 in place for ever, they will allow you to get to the bottom of your current issue.

Upvotes: 0

Related Questions