# Related Sites > SQL Course >  DB2 Error when running DTS package

## jjkatz

Hello:

I am using SQL Server 2000, SP4.  I have a DTS package that creates some .txt files and then tries to upload them to a DB2 server using a .cmd script.  The .cmd script calls a .sql file that has the username, password and upload details.

When I run the .cmd script on its own, by double-clicking it in Windows Explorer, it runs successfully.  When I try to execute it from within my DTS package, I get the following error:

"DB21005E  An error occurred while accessing the file...."

I've Googled the error message and all I could find was that it may be a permissions issue of some kind.  The SQL account I am using to run the DTS package has DBO permissions.  It is the same account I use to run all my DTS packages and this is the only one failing.

The error appears to be occurring when trying to open the .sql file as opposed to trying to run the commands in it.  I don't think it's getting that far.

Any ideas?  I'm stumped!

----------


## rmiao

Where is the .cmd file? Does sql service account have permission to access it?

----------


## jjkatz

I think the problem was that the .cmd file did not include a command to switch to the directory that the .sql file was in before trying to execute it.  That wasn't a problem when I was executing the .cmd file directly, but was a problem when calling it from the DTS package.

----------


## rmiao

You can call sql file with full path.

----------


## jjkatz

That's what I did and that piece seems to be working now.  We're getting other errors but they seem unrelated.  If necessary I'll start a new thread; meanwhile we're troubleshooting at this end.

Thanks for your replies.

----------

