cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar

Authenticate DBC user and pass before storing them for future use

Hi,

I am writing some code to pull data from an ODBC connection. I want to test if the username and password entered are valid. The script is as follows:

 

dbc = Create Database Connection("Driver={Oracle in instantclient11_1}; DBQ=" || target || "; UID=" || user || ";PWD=" || pass || ";FBS=12800000;");

I found some solutions suggesting checking if dbc is empty to see if the connection was created as a way to check for the correct user and pass. However, when I enter the incorrect details for the username and password, I get an ODBC prompt to enter the correct username and password. I do not want this prompt and would like the script to run and return an empty dbc object. 

 

The scripting index says I can use a boolean value after the connection string to disable the prompt: 

dbc = Create Database Connection("Driver={Oracle in instantclient11_1}; DBQ=" || target || "; UID=" || user || ";PWD=" || pass || ";FBS=12800000;", 0);

 

However, running the above code results in the error:

 

Expecting DriverPrompt Boolean argument

I get the same error if I use true, false or As Boolean(0). Any help to solve this will be great. Alternatively, any other suggestions to validate the username and password for a DB connection are welcome.

 

Thanks!

 

 

2 REPLIES 2

Re: Authenticate DBC user and pass before storing them for future use

Potential answer: I think this link might be helpful for what you're trying to do.

 

Word of caution: Your IT and/or Security departments might have issues with storing credentials. Prudent behavior would likely include their input, when/if applicable.

Re: Authenticate DBC user and pass before storing them for future use

Hi Jed, Thanks for the reply. I don't want to store passwords and share even if its in an encrypted file. I just want to save the user and pass to a local location or for example using powershell credential manager in the user's PC (I have seen implementations of this in the community posts). Our DB credentials expire every few months, so I wanted a way to check if the stored password works every time a connection is tried for the first time in a JMP session and if not, prompt a login window.