Re: Java running MS-SQL job?
From: Andy Flowers (notsupplied_at_nowayhose.com)
Date: 10/11/04
- Next message: SteveE: "Unable to load JdbcOdbc library"
- Previous message: 9394: "help...js+php+mysql"
- In reply to: Mike: "Java running MS-SQL job?"
- Next in thread: Nathan Zumwalt: "Re: Java running MS-SQL job?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 11 Oct 2004 11:38:02 GMT
Have you tried looking at CallableStatement ?
See also Connection.PrepareCall(...)
"Mike" <mrea@ohiotravelbag.com> wrote in message
news:81672663.0410081256.6cb00d87@posting.google.com...
> Is there a way in Java to run an MS-SQL saved job?
>
> I have a saved job called test, I can run the following in the Query
> Analyzer and it runs fine:
>
> SQL CODE
> Exec msdb.dbo.sp_start_job @job_name = 'test'
> END SQL CODE
>
> I tried running this out of java, but get The specified @job_name
> ('test') does not exist. Here is what I am doing.
>
> I have a database connection before this and I know it works fine.
>
> CODE
> String t_job="test";
> PreparedStatement state = con.prepareStatement("EXEC
> msdb.dbo.sp_start_job @job_name =?");
> state.setString(1, t_job);
> boolean rs_exists = state.execute();
> END CODE
>
> I have a few scripts and dts packages that I want users to run instead
> of scheduling. I can set these scripts and dts packages to run as SQL
> jobs. It would be great if I could provide a list of these jobs in an
> html form and pass the parameter off to a jsp such as this that would
> run the proper job.
>
> Thanks in advance.
- Next message: SteveE: "Unable to load JdbcOdbc library"
- Previous message: 9394: "help...js+php+mysql"
- In reply to: Mike: "Java running MS-SQL job?"
- Next in thread: Nathan Zumwalt: "Re: Java running MS-SQL job?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|