DTS Java-application Package Execution

  • How can I run a DTS package, that contains a Java application, as a result of a database insert event that fires an SQL-trigger?

    It seems impossible, even if I try to run the package as a sceduled Job in SQLServer 2000.

    However, in the DTS Package Designer environment the Java-application Package is executed successfully...

    Thanks in advance.

  • We've had other conversation topics on this... Basically, it's not a good idea to fire the DTS package from a trigger. Better would be to write a table and then have a job periodically poll the table.

    However, it you are interested in running the DTS package, you'll have to use xp_cmdshell and use DTSRUN.exe.

    Try this discussion:

    http://www.sqlservercentral.com/forum/topic.asp?TOPIC_ID=1587&FORUM_ID=19&CAT_ID=3&Topic_Title=DTS%20and%20stored%20procedures&Forum_Title=Data%20Transformation%20Services%20(DTS)

    K. Brian Kelley

    bkelley@sqlservercentral.com

    http://www.sqlservercentral.com/columnists/bkelley/

    Edited by - bkelley on 01/08/2002 08:35:40 AM

    K. Brian Kelley
    @kbriankelley

  • I agree with Brian. don't fire it from a trigger. If you need to run it, store some flag value in a table based on the trigger and then run the job every xx minutes and check for the flag.

    Steve Jones

    steve@dkranch.net

  • Dear Brian and Steve,

    first of all thank you for your replies.

    As I wrote, even if I try to run the package as a scheduled Job in SQLServer 2000 (and not use a trigger mechanism at all), the Java application that I'm working on, is not being executed successfully.

    It seems that the application is launched and executed within the SQLServer 2000 environment... However, the application's GUI is not displayed and the job is not terminated.

    I have also tried to use xp_cmdshell to run the package, but the some problem occurs.

    The strange thing is that in the DTS Designer a package's process task such as calc.exe or my Java-application is launched and executed successfully (the GUIs are displayed). However, when I'm trying to run the package as a job, or through a stored procedure the GUIs are not displayed.

    Do you have suggestions in order to face this difficulties?

    Thaks in advance...

  • When you are running through DTS Designer, you have an interactive session. Things like GUIs can be displayed. However, when you run as a job, there isn't an interactive session. So your GUIs don't have anywhere to display. I don't know how Java handles this, but I know that Microsoft Automation components don't do so very well... to the point where Microsoft said don't use Office Automation server-side.

    Since Java programs can be written which don't require GUIs, why are you using such with a job that won't have an interactive user?

    K. Brian Kelley

    bkelley@sqlservercentral.com

    http://www.sqlservercentral.com/columnists/bkelley/

    K. Brian Kelley
    @kbriankelley

  • Hate to say it, but running a job with a GUI on a schedule is a bad idea. You should rewrite the app to urn without a GUI.

    Steve Jones

    steve@dkranch.net

  • Dear Brian and Steve,

    I suppose you are right. However, I can't figure out what is the purpose of enabling the execution of a process task within the DTS Designer environment only...

    Thank you for your suggestions.

    Best Regards.

  • The key here, though, is that you have an app that runs in interactive mode. Anything that runs as a job shouldn't have any components that require user interaction... automated processes, right? That's actually the issue here. We run process tasks all the time, but they don't require a console.

    Can you write a java applet that doesn't require the console to do what you're trying to do with the interactive application that you currently have?

    K. Brian Kelley

    bkelley@sqlservercentral.com

    http://www.sqlservercentral.com/columnists/bkelley/

    K. Brian Kelley
    @kbriankelley

  • Dear Brian,

    I'm afraid the application I'm talking about is a rather complicated one, in order to be written and executed as a Java applet.

    Thanks for your suggestion.

  • I'm thinking you may be at an impasse unless someone else has some ideas. About the only other thing I can think of is to allow the SQLSERVERAGENT service to interact with the desktop (service setting) though I've not seen any literature stating one way or the other whether this is safe. We've had to do this with a particular application in our environment. The GUI still won't splash on the client, but perhaps the java app will run. I wouldn't do it on a production server until I was sure there were no issues.

    K. Brian Kelley

    bkelley@sqlservercentral.com

    http://www.sqlservercentral.com/columnists/bkelley/

    K. Brian Kelley
    @kbriankelley

  • I agree with Brian. If you cannot be sure this will not hang something, I wouldn't do it.

    One thing you could test is executing it with the NT scheduler on a test machine and seeing if it can run without someone logged in.

    Steve Jones

    steve@dkranch.net

Viewing 11 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic. Login to reply