SQL Agent
The SQLAgent Execution Method lets you use JAMS to run a SQL Server Agent job and report its outcome back to JAMS. The SQL Server Agent job must already exist on the target SQL Server before you set up the JAMS Job. SQL Server Agent jobs cannot be created or modified from within JAMS.
In the Web Client, you can create, view, and edit SQLAgent Jobs, and select the SQL Server Agent job to run from a list of the jobs available on the target server.
Before You Begin
Before you set up a SQLAgent Job, ensure you have the following:
- A SQL Server that JAMS can reach, with the SQL Server Agent service running.
- The name of the SQL Server Agent job to run, and an account with access to that job.
- A decision on how JAMS connects to the SQL Server:
- SQL Connection – A SQL Server Connection from the Connection Store. The Connection holds the server and login details. See Connections to Database Servers for more information.
- Agent Server – The SQL Server name, entered on the Job, with one of the following authentication modes:
- Windows Authentication – JAMS connects with the Windows account that runs the Job. No additional Credential is needed.
- SQL Server Authentication – JAMS connects with a SQL Server login, stored in a JAMS Credential.
- An Agent, if the Job will run on an Agent rather than the JAMS Scheduler. See JAMS Agents for more information.
Creating Credentials
You need a Credential that runs the Job in JAMS. If you will use SQL Server Authentication, you also need a second Credential that stores the SQL Server login.
Adding a Credential for Running the JAMS Job
This Credential is selected in the Execute As field on the Job's Properties tab. It must be a valid user on the Windows machine where the Job runs.
- Click Environment from the main menu.
- Click Credentials.
- Click Add. The Add a New JAMS Credential drawer opens.
- In the Display Name field, enter a name for the Credential.
- In the Logon Username field, enter the username for the Credential.
- In the Password and Reenter Password fields, enter the password.
- Click Save & Return.
Adding a Credential for SQL Server Authentication
This Credential is selected in the Credential field on the Job's Source tab. It is needed only when the Job uses SQL Server Authentication.
- Click Environment from the main menu.
- Click Credentials.
- Click Add. The Add a New JAMS Credential drawer opens.
- In the Display Name field, enter a name for the Credential.
- In the Logon Username field, enter the SQL Server login name.
- In the Password and Reenter Password fields, enter the password for the SQL Server login.
- Click Save & Return.
See Credentials for more information.
Creating a Job in JAMS for SQL Agent
-
Click Jobs from the main menu.
-
Click a Folder in the Folder Navigator where the Job will be saved.
-
Click Add. The Add a New JAMS Job drawer opens, with the Folder field set to the selected Folder.
-
In the Job Name field, enter a name for the Job.
-
In the Execution Method field, search for and select SQLAgent.
-
Click Save & Continue. The Job opens for editing.
-
Click the Source tab.
-
In the SQL Connection field, select one of the following. The default for a new Job is Enter Manually.
- Select Connection – In the Connection field, select the SQL Server Connection from the Connection Store.
- Enter Manually – Enter the following:
- In the Agent Server field, enter the name of the SQL Server.
- In the Authentication Mode field, select Windows Authentication or SQL Server Authentication. The default is Windows Authentication.
- If you selected SQL Server Authentication, in the Credential field, select the JAMS Credential that stores the SQL Server login. The Credential field is displayed and required only for SQL Server Authentication.
-
In the Jobs on Agent field, select the SQL Server Agent job to run. This field is required.
The Jobs on Agent field is available once the connection is complete: a Connection is selected, or an Agent Server is entered along with a Credential when SQL Server Authentication is used. JAMS then lists the SQL Server Agent jobs on that server. You can type to filter the list. If the list cannot be loaded, a message explains why, and you can type the job name instead. Job names can be up to 128 characters.
-
Click Save.
-
Click the Schedules tab to add schedule items to set when the Job will run. See Schedules for more information.
-
Click the Properties tab.
-
In the Execute As field, select the JAMS Credential to run the Job.
-
In the Agent field, select the Agent if the Job will not run on the Scheduler.
-
Click Save.
After you create the Job, it is submitted based on its schedule. You can also submit it manually. See Manually Submitting Jobs for more information. To view the Job's progress, click Monitor from the main menu.
Saving the Source
When you click Save on the Source tab, JAMS checks the required fields before saving. A message is displayed under each field that needs a value:
- SQL Connection or Agent Server – One of them is required.
- Credential – Required when using SQL Server Authentication.
- Jobs on Agent – Required.
Each message clears as soon as you fill in the field. If the JAMS Server rejects the change when you save, its error message is displayed on the form, and the Source is not saved until you correct it.