DBConnect & Hiding Connection String

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
ClearPhoenix
Newbie
Posts: 6
Joined: Tue Aug 30, 2016 1:15 pm

DBConnect & Hiding Connection String

Post by ClearPhoenix » Tue Aug 30, 2016 2:12 pm

Hello All;

A bit of back story here, may help to outline why I need what I need.

Part of our ERP system requires a "costing operation" to be completed on a regular basis, this is for general ledger transactions, journal postings etc etc. This costing process needs to be run a lot... and it takes roughly 5 hours to complete.
Not that someone is hammering keys for 5 hours every day, more like open window, press save, wait an hour, and then keep going on.
Problem is that you can't "side load" this, as while the process is going about its work the computer on which it is running is pretty much useless.
This is where this lovely product comes into play, thank you MacroScheduler!


Now, onto what I'm trying to get done here:

As part of this costing process, I need to have the macro logged, so that if it fails somewhere through the process, the log can be reviewed to see exactly where it stopped functioning. Multiple people can access this log.

The macro connects to the ERP system database to run checks to see if it should run certain SRTs, and run a procedure that may actually run deletes if it's required. The other catch to this is that I have to connect and run these processes as a system admin.

In the macro I must specify this admin user name and password and of course it's in plain text, because of logging this admin user is exposed.

I'm trying to find a way to hide or mask this connection string from the logs and I cannot find anyway to achieve this.

I tried putting the database connection in a separate macro, and then call it through the use of Macro> and using the system variable MACRO_RESULT, but you cannot return the database connection through the variable, all that is returned via MACRO_RESULT is a numeric value of 1.

If anyone has any thoughts on either:
  • masking the username and password in the script log
  • externally calling the database connection and returning the connection
  • disable/enable logging output as the script progresses
These are my main 3 ideas on how to not show the username/password/connection string.

If anyone has any other ideas I'd really appreciate it.

User avatar
JRL
Automation Wizard
Posts: 3531
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Re: DBConnect & Hiding Connection String

Post by JRL » Tue Aug 30, 2016 2:28 pm

Assuming you are logging using the built in Macro Scheduler log to file option, you can turn logging on and off in the script by using the "_WRITE_LOG_FILE" variable. Its default value is 1 (one), if it is set to 0 (zero) logging stops until it is set back to 1.

Code: Select all

//do some stuff that gets logged
Let>_WRITE_LOG_FILE=0
//use password not logged
Let>_WRITE_LOG_FILE=1
//continue logging

ClearPhoenix
Newbie
Posts: 6
Joined: Tue Aug 30, 2016 1:15 pm

Re: DBConnect & Hiding Connection String

Post by ClearPhoenix » Tue Aug 30, 2016 6:25 pm

Fantastic JRL, that works perfectly fine for me. I just don't want the connection stuff in the logs, glad that there is a flag to turn off the built in logger. Thank you very much!

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts