Skip to content
ODBC/SQL authentica...
 
Notifications
Clear all

ODBC/SQL authentication without storing credentials in model

2 Posts
2 Users
0 Likes
941 Views
Lonnie Chrisman
Posts: 40
Admin
Topic starter
(@lchrisman)
Member
Joined: 14 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?

1 Reply
Lonnie Chrisman
Posts: 40
Admin
Topic starter
(@lchrisman)
Member
Joined: 14 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: