Showing posts with label drive. Show all posts
Showing posts with label drive. Show all posts

Thursday, March 29, 2012

DTS run from .NET

My dts package has to pick up a file which is in a mapped drive of the
sql server... (system1)...
when I run it from code the execution ends up in an error... but if I
have the drive mapped (drive where I have the source file) onto the
web server (system2) the execution goes through fine.. I donot want to
have the drive mapped onto the web server.. how can I do this..Try and use the UNC path.

Joel Scavone|||I did use a full netwok path and even did add identity impersonate in
the web.config... but does not help..

The package runs fine when I register the sql server my machine and run
the package..

Sigh! Don't know what wrong

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Sunday, March 11, 2012

DTS package failing with Object required WScript

I have the following error when I try to execute a DTS package.
All the package is doing, is a bit of WScript to map a drive (need it for other packages), so:

[code]

Function Main()
Dim WshNetwork
Set WshNetwork = WScript.CreateObject("WScript.Network")
WshNetwork.RemoveNetworkDrive "S:"
WshNetwork.MapNetworkDrive "S:", "\\myserver\folder1\folder2\folder3\folder4"
Main = DTSTaskExecResult_Success
End Function

[/code]

If I copy it out to a .vbs file and execute it logged in as the SQL Agent profile, it works. Execute the package under a job, or just execute it, it fails with the above error.
Any ideas?

This is a SSIS forum, not DTS! Try microsoft.public.sqlserver.dts, you're more likely to get help there.

-Jamie

|||WScript object is specific to wscript.exe host application (that runs .VBS files), it is not part of VBScript language, so you can't use it in DTS scripts.
I think just CreateObject (without "wscript.") should work as well, but I don't know VBScript. You may try VBScript or DTS newsgroups to get better answer.|||

Sussed it. If I use:

Set WshNetwork = CreateObject("WScript.Network")

It works fine

Wednesday, March 7, 2012

DTS not running on a mapped drive

I created a DTS local package on the SQL Server. It's basically importing a text file into a table in my database. This file resides in a mapped drive (X:) from another server. When I schedule the DTS as a job, it fails. It doesn't execute any of the workflow in the design.

However, when I copy the text file into a drive local to the SQL server (D:), it runs flawlessly.

What I do right now is I have a windows scheduled task that runs a batch file that copies the text file from X: to D: at certain time intervals. Then the job scheduler runs to import it.

What am I missing? How come the job scheduler can't read the file directly from the mapped drive?

Any info would be appreciated. TIAWhat am I missing? How come the job scheduler can't read the file directly from the mapped drive?

Any info would be appreciated. TIA

A mapped drive only exists in the context of your login session. You will need to use a UNC path to reference the file:

\\MyServer\ServerShare\Path\FileName.txt

Alternatively (NOT recommended), you can use the command NET USE, but you are much better off using UNC.

Regards,

hmscott|||Thanks - that worked for me.