viewpoint-particle

Author Topic: SQL Connection String  (Read 252 times)

Jeff

  • Newbie
  • *
  • Posts: 44
SQL Connection String
« on: May 29, 2019, 07:31:34 am »
Hi all.
I am tinkering with WebBatch for the first time and doing a small project to get an understand of it. I am connecting to a SQL server database and pulling the DB information as expected. <I am proud!>

My current problem is the connection string is sitting in plain text with a SQL user name and password. I do not have the option to use domain authentication as part of the connection string. So, is there a way to hide or encrypt the connection string so the SQL username and password is not sitting in plain text?

SQLConn.ConnectionString = "Provider=SQLOLEDB;Data Source=MyServer;Initial Catalog=MyDataBase;User ID=MyUserId;Password=MyPassword"

 
Jeff

td

  • Tech Support
  • *****
  • Posts: 3019
    • WinBatch
Re: SQL Connection String
« Reply #1 on: May 29, 2019, 08:07:45 am »
You could split your script into separate scripts and compile the script with sensitive information using the "Encode for calls from EXE files" compiler option.  You can then call the compiled .wbc file from a plan text .web script.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

Jeff

  • Newbie
  • *
  • Posts: 44
Re: SQL Connection String
« Reply #2 on: May 29, 2019, 08:13:27 am »
Ok, I like the thought process, but I have some questions.

Can I call another exe from a WEBBATCH script?

Where is the material on making this work?
Jeff

td

  • Tech Support
  • *****
  • Posts: 3019
    • WinBatch
Re: SQL Connection String
« Reply #3 on: May 29, 2019, 08:50:29 am »
You do not need to call "another exe" to call a compile .wbc file from WebBatch script.  You just use the WIL Call function to execute the encoded script from your WebBatch script. You treat the .wbc file just like you would any other script you execute using the WIL Call function.

Not sure what you mean by "material" but the compiler is documented in the Consolidated WIL Help file.  Go to:

 Home > WinBatch Users Guide > Compiler > Compile Options > Encode for Call's from EXE files
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

Jeff

  • Newbie
  • *
  • Posts: 44
Re: SQL Connection String
« Reply #4 on: May 29, 2019, 09:12:14 am »
Thanks-I just need to find the reading material or an example.
Jeff

td

  • Tech Support
  • *****
  • Posts: 3019
    • WinBatch
Re: SQL Connection String
« Reply #5 on: May 29, 2019, 09:32:09 am »
There isn't "reading material" specific to calling a .wbc file from a script.  This is because the concept and implementation are very simple.  If you are not familiar with the WIL Call function, read about it in the Consolidated WIL Help file. The function is used in many places in the Tech Database.  Once you understand calling one script from another you just need to use the WinBatch Compiler to create an encrypted version of the script you want to call and then call it using the WIL Call function.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade