Error - Cannot open the datafile
Hi there, I have written a program that loads a package (SomePackage.dtsx) from the physical drive and executes that. The package does nothing but imports data from a csv file to the Sql server 2005. But I can see that the package is failing continuously. I meant the package.Execute() method is returning a DTSExecResult.Failure. I investigated the Package.Errors property that contains the error collection and found that there are two DTSError objects into the collection. The first ones description says that Cannot open the datafile "D:\SOME.csv". And the later ones is component "SOURCE FLAT FILE COMPONENT" (1) failed the pre-execute phase and returned error code 0xC020200E. But the most interesting thing is if I execute the package through the Execute package Utility (double clicking onto the SomePackage.dtsx file) ships with Sql server 2005 then it executes fine and works as expected. I have checked the permission of the csv file and it has everyones full access. Can anyone help me on this? I will appreciate all kind of suggestions. Thanks Moim
January 4th, 2007 8:07am

Hi, "right click" the "flatfile connection manager" click on "Edit". there are several properties here that needs to be configured one of which is the "format".. make sure its "delimited" or something that suits your need. if it didn't solve your problem try other properties in this area. regards, joey
Free Windows Admin Tool Kit Click here and download it now
January 4th, 2007 8:30am

What is different about when you use your tool vs dtexecui? Is this the same machine? Is this the same user running both tools?
January 4th, 2007 8:39am

Darren, BasicallyI can see the only difference is when I am running through the code it is failing and when I am running from the windows explorer it is working. Nothing more. It is same machine, same user. Any Idea? Thanks Moim
Free Windows Admin Tool Kit Click here and download it now
January 4th, 2007 12:21pm

joeydj, Im afraid, I have created that package programmatically so I dont have a scope to edit that inside the Sql Server BI editor. anyway, I checked out and these properties are set. Any Idea? Thanks Moim
January 4th, 2007 12:27pm

Is your file on a mapped drive, by chance?
Free Windows Admin Tool Kit Click here and download it now
January 4th, 2007 12:45pm

Brammer, No its on a local drive (drive D: ). Any other idea? THanks Moim
January 4th, 2007 1:40pm

Ok, so same package, same machine, same user, same execution parameters, just a different execution host... does not make much sense. Try adding logging to the package, something simple like log all warnings and errors to a text file. Any other errors? There must be some difference but that error is not very clear as to what.
Free Windows Admin Tool Kit Click here and download it now
January 4th, 2007 8:00pm

I had same problem and I am using UNC path. The problem occures after changing the logic of package. why we get this error and how to troubleshoot this?thanks,------------------------ Brahma http://vbrchowdary.info
March 16th, 2010 8:57am

How can this be the accepted answer?
Free Windows Admin Tool Kit Click here and download it now
January 31st, 2011 3:47pm

I had a similar issue and the above accepted answer does not solve it. Without going into too much detail, I've a loop container iterating through and envoking a data flow task to load multiple flat files. I was passing the filename as a variable but ommitted to include the path! I added the path as a variable in the expression and violá! To debug, perhaps try output the path & filename on execution and confirm it's as expected? hope this helps! KP
June 10th, 2011 7:32am

Ya, thats right. Passing only filename without path. Thanks buddy.Jagalla
Free Windows Admin Tool Kit Click here and download it now
July 28th, 2011 7:03am

Hi, I have my data files on a mapped drive would it make a difference? They are on a NAS. System/windows has full access to it.
June 4th, 2012 2:32pm

Avoid using mapped drives, and use the UNC instead. In most cases the failure is due to permissions, thus executing a package using a domain proxy is often necessary.Arthur My Blog
Free Windows Admin Tool Kit Click here and download it now
June 4th, 2012 2:54pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics