Network Automation Software We are currently migrating this forum
over to our HelpSystems domain. Please
post all new threads in our new
HelpSystems Community Portal.
Post to the HelpSystems Forum
You are not currently logged on. You must be logged on in order to post. Log on
Or Create a new account
AutoMate Discussion
Decrease font size
Increase font size
Topic Title: Open SQL Connection will not toggle within one task
Topic Summary: Trying to open a different database based on agent machine
Created On: 07/07/2015 08:11 AM
Status: Read Only
Linear : Threading : Single : Branch
Search Topic Search Topic
Topic Tools Topic Tools
View similar topics View similar topics
View topic in raw text format. Print this topic.
Answer This question was answered by TonGordon, on Wednesday, July 8, 2015 11:26 AM

Answer:
Valentineo,

Sorry, this was my fault. From an earlier version I had a mis-spelling of the SQL Session variable in the first part of the if statement. When I fixed that everything worked. And I didn't need to set DBconnection explicitly once I found that so the BPA code is working the way it should. Thanks for the help.
 07/07/2015 08:11 AM
User is offline View Users Profile Print this message

Author Icon
TonGordon
Journeyman (50-99)

Posts: 87
Joined: 05/17/2011

To put this simply I am trying to connect to a different database based on the agent machine I am running on. We are doing this to have workflows run on dev/uat/prod environments based simply on the default agent for the workflow. I am trying to use Open SQL Connection to accomplish this. In order to use a different pre-defined connection string for each database I have to change the agent and edit the task through the workflow. When I run the workflow on the 2nd database machine defined I the error message below. This same code works if I set the default agent to ServerTwo. I want to know if one Session SQL Connection can point at different databases in the same task. The code is shown attached. Ignore the upcase stuff, I had to change the server names because they are our internal names.

Error Message:
7/7/2015 7:47:25 AM,Task 'dbTest' running on agent 'ServerOne' failed because: Session DBServerEnv could not be found. (Step 10)
7/7/2015 7:47:25 AM,Workflow 'dbTest' failed.




 Category Survey
AutoMate BPA Server 9 version:
Windows version:



Task Steps: (Right click, Select All, Copy to copy to the clipboard. Steps can then be pasted into the AutoMate Task Builder)


Edited: 07/07/2015 at 08:59 AM by TonGordon
 07/08/2015 08:48 AM
User is offline View Users Profile Print this message

Author Icon
Valentineo McGowan
HelpSystems

Posts: 766
Joined: 09/03/2013

Hello TonGordon,

By using the 'Set Variable' activity in conjunction with your IF logic we should be able to 'toggle' which DB to connect to within one task.

Please try the attach code and let me know if this helps.


 Category Survey



Task Steps: (Right click, Select All, Copy to copy to the clipboard. Steps can then be pasted into the AutoMate Task Builder)


-------------------------

Valentineo McGowan | Technical Consultant
AutoMate | Division of HelpSystems
HelpSystems, LLC | T: +1 213.738.6966 | F: +1.213.738.7665
 07/08/2015 11:25 AM
User is offline View Users Profile Print this message

Author Icon
TonGordon
Journeyman (50-99)

Posts: 87
Joined: 05/17/2011

Answer Answer
Valentineo,

Sorry, this was my fault. From an earlier version I had a mis-spelling of the SQL Session variable in the first part of the if statement. When I fixed that everything worked. And I didn't need to set DBconnection explicitly once I found that so the BPA code is working the way it should. Thanks for the help.

 Category Survey
AutoMate BPA Server 9 version:
Windows version:
Statistics
18258 users are registered to the AutoMate Discussion forum.
There are currently 0 users logged in.
The most users ever online was 5551 on 01/08/2018 at 11:11 AM.
There are currently 1680 guests browsing this forum, which makes a total of 1680 users using this forum.

FuseTalk Enterprise Edition v4.0 - © 1999-2020 FuseTalk Inc. All rights reserved.

Sitemap Network Automation Software Blog