Sunday, February 19, 2012

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 one’s description says that

Cannot open the datafile "D:\SOME.csv".

And the later one’s 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 everyone’s full access.

Can anyone help me on this?

I will appreciate all kind of suggestions.

Thanks

Moim

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

|||

What is different about when you use your tool vs dtexecui?

Is this the same machine?

Is this the same user running both tools?

|||

Darren,

Basically I 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

|||

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

|||Is your file on a mapped drive, by chance?|||

Brammer,

No its on a local drive (drive D: ).

Any other idea?

THanks

Moim

|||

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.

No comments:

Post a Comment