November 2, 2015 at 3:34 am
Hi all
wonder if you can help me............
We run some VB scripts to extract data from our SQL server. Within these scripts we reference a 'read only' SQL userid and it's password in the connection string.
What I want to do is remove the references to the 'read only' user and it's password from the scripts.
Could we add the user that is running the script as a SQL authenticated user (that has read only access) thereby not have to reference any passwords in our script ?
Thanks for any help.
November 2, 2015 at 3:39 am
Two options, if you want to use SQL authentication and pass in a username and password you would need build the connection string dynamically. Saves storing the username and password in the VBScript
Or
Switch to trusted connection using your windows account for authentication
Something like
<%
'declare the variable that will hold the connection string
Dim ConnectionString
'define connection string, specify database driver and location of the database
ConnectionString="Driver={SQLServer};Server=your_server_name;" &_
"Database=your_database_name;Trusted_Connection=yes;"
%>
November 2, 2015 at 3:47 am
Hi - thanks for the prompt(!) reply.
Yes I didn;t ask about windows authentication. So really we could add the user that is running the vb script as a windows authenticated user to SQL and not have to explicitly reference any passwords in our scripts? (our server ia VM on a farm so not entirely sure whether windows authentication is allowed).
November 2, 2015 at 3:51 am
Correct, if your server allows Windows authentication that's the better option.
Otherwise your talking about adding 2 parameters to the script to prompt for username and password then using them to build a dynamic connection string.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply