Link to home
Create AccountLog in
Avatar of arthrex
arthrexFlag for Germany

asked on

SSIS Error: "The process cannot access the file because it is being used by another process."

Hi experts,

I created a package in SSIS where I transfer Data from XML files to a database table using a foreach loop.
I have a contraint on the database table and when one of the XML files hits that constraint, the XML file should get moved to a certain ErrorFolder.

So I created an EventHandler "OnError" which holds a FileSystemTask.
See the configuration of the FST below

But I always receive the error "The process cannot access the file because it is being used by another process."

What do I do wrong?
fst.JPG
Avatar of bashka_abdyli
bashka_abdyli
Flag of Albania image

Check maybe you have the file opened by other application.
Avatar of arthrex

ASKER

Hi,
thanks for your help.

No, there is no other application accessing these files. I really have no clue what the problem is...
Any further help is appreciated...
Avatar of arthrex

ASKER

Ah ok, I think I know the problem now.

I want to move the xml file to a certain folder when the insert constraint on the database hits. So what I do is add an OnError Event on the data flow task.
But that seems to cause the problem because it seems that SSIS tries to insert the record into the database, hits the constraint and then wants to copy that file while the file is still somehow connected to the database insert statement.
So I guess the "OnError" Event is simply the wrong event.
But does anyone know what event I should use?
ASKER CERTIFIED SOLUTION
Avatar of bashka_abdyli
bashka_abdyli
Flag of Albania image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of Darthpre
Darthpre

how do I close the session with the file in SSIS???