![]() |
| |||||||
Automation Anywhere Post messages and questions related to Automation Software here. |
![]() |
| | LinkBack | Thread Tools | Display Modes |
| |||
|
I will soon be creating several tasks that will scrape data from the web and insert it into a database. I wan't to separate out my db connection from the individual tasks... so I tested out putting the connection into a sub-task and then calling that sub task from the scraping task. This didn't work because the session doesn't get passed between the child and parent tasks... which is understandable. So I'm looking for a solution to having my database connection stored in a single location... so that if my database location/name/credentials change, I can update it all in one spot. Any suggestions? |
| |||
|
Hello, The Database:Connect command provides variable support for session name and connection string fields so what you can do is, use global variable that would read the value for these fields from a text file. That way whenever you need to change the credentials, just make the changes in the text file and you are done. We have attached a sample task for your reference. To run this sample, . Please copy .atmn under location, 'C:\...\My Documents\Automation Anywhere\Automation Anywhere\My Tasks' folder. . Copy .txt under C:\. Note: In all the sub tasks that you will create copy-paste these global variables. Hope that helps. |
| |||
|
Hello, Unfortunately yes. However, there is one more option for global database connection. What you can do is, . Create separate database say MyDB.mdb, create one table in it say 'ConnectStringTable' and create one field in it say 'ConnectStringField'. . Password protect this database i.e. provide fixed username and password to connect MyDB database. . Now store the connection string in 'ConnectStringField' field of 'ConnectStringTable' table. . In your task, first connect MyDB database and get the connection string from 'ConnectStringTable' table into variable, $GlobalConnectionString$. Note: $GlobalConnectionString$ should be of Value type. In all the sub tasks, you need to copy-paste $GlobalConnectionString$ variable. . Disconnect MyDB database. . Connect to your actual database using $GlobalConnectionString$ variable. We have attached a sample task for your reference. Please copy it under location, 'C:\...\My Documents\Automation Anywhere\Automation Anywhere\My Tasks' folder. That way whenever you need to change the credentials, just open MyDB database using the username and password and change the connection string in 'ConnectStringField' field of 'ConnectStringTable' table. Hope that helps. |
![]() |
| Thread Tools | |
| Display Modes | |
| |