It's not a secret anymore!*
The moose likes JDBC and the fly likes Help needed in executing the DTSRUN command in java code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Help needed in executing the DTSRUN command in java code" Watch "Help needed in executing the DTSRUN command in java code" New topic
Author

Help needed in executing the DTSRUN command in java code

Melinda Savoy
Ranch Hand

Joined: Jun 21, 2005
Posts: 387

I am trying to execute the following in my java code:



Apparently the syntax is incorrect because I'm getting the following error (in red):

20110407 11:45:39 Error: -2147467259 (80004005); Provider Error: 0 (0)
20110407 11:45:39 Error string: DTSRun: Must specify a package source \
server or filename.

20110407 11:45:39 Error source: Microsoft Data Transformation Services \
(DTS) Package
20110407 11:45:39 Help file: sqldts80.hlp
20110407 11:45:39 Help context: 0
20110407 11:45:39 Error executing DTS package. Returned code=1
20110407 11:45:39 Searching logs to determine if any DTS errors occurred...

Any help/direction would be appreciated. Thanks.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18658
    
    8

Well, apart from the fact that most people probably don't know what the required syntax for the DTSRUN command is, you haven't showed us the command you are using. All we see is a Java statement which generates that command from a string and some other data. The first step in figuring out what's wrong with the command would be to actually look at the command.
Melinda Savoy
Ranch Hand

Joined: Jun 21, 2005
Posts: 387

Paul where I have DTSRun is the command that I had decrypted. That is what I know the command to be thatis being executed. Sorry to be so thick. That is the syntax that ms sql server says to use from what I've read.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18658
    
    8

No, it isn't. It's a string expression whose value is the command which is then executed. I'm asking you to display the value of that variable. As you suggest, that shouldn't be that difficult.

The next step is to copy the value of that variable and paste it at the command line. Usually what happens with questions like these is that the questioner hasn't used the same command in the Java code that they used in testing, but only something similar.
Melinda Savoy
Ranch Hand

Joined: Jun 21, 2005
Posts: 387

Ok. Will do. Thanks.
Melinda Savoy
Ranch Hand

Joined: Jun 21, 2005
Posts: 387

In stepping through the code in my java file here is the value of cmd:



The error, though would like some confirmation, that the "/" in the string got flipped to that above. Is that correct.

Here are the errors that got written to my console:

DTSRun: Must specify a package source server or filename.
20110413 09:40:35 DTSRun: Invalid command options
20110413 09:40:37 Usage: dtsrun /option [value] [/option [value]] ...
20110413 09:40:38 Options ('/?' shows this screen; '-' May be substituted for '/'):
20110413 09:42:33 Package retrieval:
20110413 09:42:46 /~S Server Name
20110413 09:42:49 /~U User Name
20110413 09:42:51 /~P Password
20110413 09:42:55 /E <Use trusted connection instead of /U /P>
20110413 09:42:58 /~N Package Name
20110413 09:43:01 /~M Package Password
20110413 09:43:03 /~G Package Guid String
20110413 09:43:07 /~V Package Version Guid String
20110413 09:43:09 /~F Structured Storage UNC filename (overwritten if /S also specified)
20110413 09:43:11 /~R Repository Database Name <uses default if blank; loads package from repository database>
20110413 09:43:15 Package operation (overrides stored Package settings):
20110413 09:43:19 /~A Global Variable Name:typeid=Value <may quote entire string (including name:typeid)>
20110413 09:43:24 /~L Log file name
20110413 09:43:26 /~W Write Completion Status to Windows Event Log <True or False>
20110413 09:43:29 DTSRun action (default is to execute Package):
20110413 09:43:31 /!X <Do not execute; retrieves Package to /F filename>
20110413 09:43:34 /!D <Do not execute; drop package from SQL Server (cannot drop from Storage File)>
20110413 09:43:36 /!Y <Do not execute; output encrypted command line>
20110413 09:43:38 /!C <Copies command line to Windows clipboard (may be used with /!Y and /!X)>
20110413 09:43:41 Notes:
20110413 09:43:43 ~ is optional; if present, the parameter is hex text of encrypted value (0x313233...)
20110413 09:43:44 Whitespace between command switch and value is optional
20110413 09:43:46 Embedded whitespace in values must be embedded in double-quotes
20110413 09:43:47 If an option is specified multiple times, the last one wins (except multiple /A)
20110413 09:44:19 Error: -2147467259 (80004005); Provider Error: 0 (0)
20110413 09:44:22 Error string: DTSRun: Must specify a package source server or filename.
20110413 09:44:26 Error source: Microsoft Data Transformation Services (DTS) Package
20110413 09:44:29 Help file: sqldts80.hlp
20110413 09:44:31 Help context: 0
20110413 09:45:05 Error executing DTS package. Returned code=1

Any help/direction again would be appreciated.

Thanks.
Melinda Savoy
Ranch Hand

Joined: Jun 21, 2005
Posts: 387

Got my problem resolved.

I had found 2 issues:

1. Wrong slash was used. I should have used the forward slash(/).
2. I did not have to escape the forward slash.

Thanks any way.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19720
    
  20

Thanks for sharing Users who run into this problem in the future will be highly appreciative now there is an answer.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help needed in executing the DTSRUN command in java code