Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 xp_cmdshell and WinZip

Author  Topic 

jsiedliski
Yak Posting Veteran

61 Posts

Posted - 2003-10-02 : 13:37:59
I am trying to unzip a file using xp_cmdshell and it seems to run indefinately. Ultimately, the goal is to unzip the file as part of a DTS package which retreives file, unzips the text files and imports them. I have the retreival and import all completed, just can't get the unzipping to work.

General Info:
SQL Server 2000 (SP2) running on Windows 2k
Using WinZip Command line add-on (fully licensed)


When I execute the following command from the Command prompt, it functions properly, running for about 5 secconds.


C:\wzunzip.exe -o E:\Db\TechData\Delta\datapaqpro_delta_20030922.zip

When I execute the same command using the extended stored proc xp_cmdshell - it does not finish, just hangs there:

EXEC master..xp_cmdshell 'C:\wzunzip.exe -o E:\Db\TechData\Delta\datapaqpro_delta_20030922.zip'

I have tried everything that I can think of. I am at a loss. Don't know why it just hangs up. I even tried wrapping the code in an Batch file (.bat) and executing this from xp_cmd shell - still no luck.

Any ideas?

Thanks,

Jack

Rome was not built overnight.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-10-02 : 13:46:20
Could it be waiting for an answer from the user? Some command line utilities are interactive and you need to set some switches so that it runs in quiet mode, maybe this utility works that way too.

Tara
Go to Top of Page

jsiedliski
Yak Posting Veteran

61 Posts

Posted - 2003-10-02 : 13:51:31
I thought the same thing. When I test it outside the SQL Server environemnt (running it at the command prompt), I get no opportunity to interact. It just runs and then closes the cmd.exe window.

The only thing I can think of is permissions. But I log into SQL Server with my Windows domain acct, which is the same account I use when unzipping the file on using the Command prompt.

Anyway, I am going crazy over this - dont' know what else to try.

Rome was not built overnight.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-10-02 : 13:57:25
Does the account that the MSSQLSERVER service logs in as have permissions to perform this? It's that account's permissions that are used.

Tara
Go to Top of Page

Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2003-10-02 : 14:17:59
Try streaming the output to a text file and look there to see if it's waiting for you to answer a question.

Jay White
{0}
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2003-10-02 : 14:25:33
I think tara's got it. the key permissions are the account the service is running as.

- Jeff
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-10-02 : 14:26:04
In case you don't know how to do what Jay said:


EXEC master..xp_cmdshell 'C:\wzunzip.exe -o E:\Db\TechData\Delta\datapaqpro_delta_20030922.zip >C:\OutputFile.txt'




Tara
Go to Top of Page

jsiedliski
Yak Posting Veteran

61 Posts

Posted - 2003-10-02 : 15:17:26
It was a permissions issue - I changed the log on account for MSSQLSERVER service and it works now. I guess it would have been nice to get a permissions error back from WinZip or Sql Server.

Thank you all for your help,

Jack

Rome was not built overnight.
Go to Top of Page

Tartan69
Starting Member

2 Posts

Posted - 2004-03-09 : 23:36:24
I had this same exact problem in DTS, but found a much, much simpler solution: just make sure you use the "-yb" parameter in your WZUNZIP command line call.

My specific usage was:

-yb -o c:\filename.zip c:\DirectoryToUnzipTo
The parameter listings are detailed in the WZUNZIP help files.
Go to Top of Page
   

- Advertisement -