Notifications
Clear all

ODBC/SQL authentication without storing credentials in model


Posts: 20
Admin
Topic starter
Member
Joined: 12 years ago

I am relaying a question from a user here.

We have a model that executes many separate calls to DbWrite and DbQuery.  If we do not put the user credentials in the connection string, it asks us over and over to enter the SQL username and password, i.e., every time it evaluates a DbWrite or DbQuery.  If we include user credentials in the connection string, it runs without asking, but I don't want my credentials saved with the model. Is it possible to ask the user once to enter her credentials, and then not ask again after that, but do so in a way that does not save those credentials with the model when she saves the model?

Topic Tags
1 Reply
Posts: 20
Admin
Topic starter
Member
Joined: 12 years ago

One approach is to use AskMsgText to get the credentials. You would change your Connection_string variable's Definition to something like:

Local userName := AskMsgText("SQL user name:","Database credentials needed");
Local pwd := AskMsgText("SQL password:","Database credentials needed",password:true);
f"Driver={{ODBC Driver 17 for SQL Server};Server=myServername\SQLEXPRESS;Database=myDataBase;UID={userName};PWD={pwd};"

Reply
Share:
Scroll to Top