ssis - flat file source - The process cannot access the file because it is being used by another process

2

Am attempting to use SSIS flat file source to read a log file being actively written to. Looping and waiting for the file to be released is not practical as this is an active log file held by a service.

Ideally, I'm looking for a setting upon the flat file source, similar to the C# code below. If not that, what route can I take to read the flat file? I'm attempting to stay within SSIS as I sincerely can't believe this can't be done with stock parts and assume I'm just missing something.

Using C#, I can successfully open the exact file upon which the flat file source errors

System.IO.FileStream file
= new System.IO.FileStream
    (
        file_to_hash.FullName
        , System.IO.FileMode.Open
        , System.IO.FileAccess.Read
        , System.IO.FileShare.ReadWrite
    );

This is the error message experienced in SSIS: Warning: 0x80070020 at Data Flow Task, Flat File Source [1]: The process cannot access the file because it is being used by another process. Error: 0xC020200E at Data Flow Task, Flat File Source [1]: Cannot open the datafile "XXX".

sql-server
sql-server-2005
ssis
asked on Stack Overflow Jun 21, 2010 by maassql

2 Answers

1

both ideas by tim and cade would work. I chose Tim's approach - copying the file b/c I already had the code ( both the copy and the data tranformation ), and changing the name/path of the file going into the data transformation was a configuration setting of the app being built. Wish I could mark it answered, but asked the question as an unregistered user.

answered on Stack Overflow Jun 22, 2010 by Jeff Maass
0

You probably need to write a custom data source - possibly as simple as a script task.

answered on Stack Overflow Jun 21, 2010 by Cade Roux

User contributions licensed under CC BY-SA 3.0