Sql Server Schedular and running API's


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Sql Server Schedular and running API's

  1. #1
    Nathan Reiter Guest

    Sql Server Schedular and running API's


    I am using the Sql server Agent in Enterprise manager for both Sql 7.0\Sql
    2000. I use the Active Script command in the Job Schedular to instansiate
    a COM componenet which builds a .txt file according to Main Frame Processing.
    This technique works fine (the .txt file is generated), but I need to fire
    off a .bat file for putting the .txt file via ftp up on a mainframe sector
    so a mainframe program will access it. I have used a varitety of techniques:
    Including using the OpenProcess and CreateProcess APIs, as well as the Windows
    scripting shell component. The "View Job History" screen shows that the
    job completed successfully, but the program did not run as the file was not
    Ftp'd to the mainframe sector. When I run a VB.exe program that instantiates
    the same COM component, the .bat does run and the ftp process occurs successfully.
    It seems that the Sql server Job agent does not conduct .exe or .bat processses
    correctly, while another VB program runs the processes fine. Ideally I would
    like to have the job schedular conduct this process, as it will tie more
    directly into the making of the .txt file that is generated by the Sql Server
    Active Schedular. Any input here would be greatly appreciated.

    thanks

    Nathan Reiter
    Share on Google+

  2. #2
    Rob Vieira Guest

    Re: Sql Server Schedular and running API's

    If this is what I think it is, then I believe there is a knowledge base
    article on this somewhere. This is a known issue and, as it turns out, was
    first reported by a co-worker of mine. I'm sorry to say that I don't recall
    the exact cause, but it was expected to be fixed eventually (though their
    were indications that the problem was fundamental in nature, and so a fix
    would take a while).

    So, what do I "think it is?" Well, I suspect that you're actually getting an
    error while you're running the program under the SQL Agent. I'll get to what
    the error is in a moment, but the fact than an error is being generated by
    not reported by the scheduler is the troublesome part that needs to be
    fixed.

    OK, so what is the error? Well, I'm guessing that the issue is that the
    Windows account being used by the scheduler does not have the appropriate
    rights to create the file. When you run it under VB, it's using your
    security token, but under SQL Server it's using the SQL Agent's security
    token. Check out the rights for the account that you're using with the job
    scheduler.


    --
    Rob Vieira
    Visit www.ProfessionalSQL.com Today. It's new and improved!


    "Nathan Reiter" <nreiter@state.nm.us> wrote in message
    news:3a6d9557$1@news.devx.com...
    >
    > I am using the Sql server Agent in Enterprise manager for both Sql

    7.0\Sql
    > 2000. I use the Active Script command in the Job Schedular to instansiate
    > a COM componenet which builds a .txt file according to Main Frame

    Processing.
    > This technique works fine (the .txt file is generated), but I need to

    fire
    > off a .bat file for putting the .txt file via ftp up on a mainframe sector
    > so a mainframe program will access it. I have used a varitety of

    techniques:
    > Including using the OpenProcess and CreateProcess APIs, as well as the

    Windows
    > scripting shell component. The "View Job History" screen shows that the
    > job completed successfully, but the program did not run as the file was

    not
    > Ftp'd to the mainframe sector. When I run a VB.exe program that

    instantiates
    > the same COM component, the .bat does run and the ftp process occurs

    successfully.
    > It seems that the Sql server Job agent does not conduct .exe or .bat

    processses
    > correctly, while another VB program runs the processes fine. Ideally I

    would
    > like to have the job schedular conduct this process, as it will tie more
    > directly into the making of the .txt file that is generated by the Sql

    Server
    > Active Schedular. Any input here would be greatly appreciated.
    >
    > thanks
    >
    > Nathan Reiter



    Share on Google+

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center