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

ODBC/SQL authentication without storing credentials in model

2 Posts
2 Users
0 Reactions
1,303 Views
Lonnie Chrisman
Posts: 42
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: 42
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:

Download the free edition of Analytica

The free version of Analytica lets you create and edit models with up to 101 variables, which is pretty substantial since each variable can be a multidimensional array. It also lets you run larger modes in ‘browse mode.’ Learn more about the free edition.

While Analytica doesn’t run on macOS, it does work with Parallels or VMWare through Windows.


    Analytica Cubes Pattern

    Download the free edition of Analytica

    The free version of Analytica lets you create and edit models with up to 101 variables, which is pretty substantial since each variable can be a multidimensional array. It also lets you run larger modes in ‘browse mode.’ Learn more about the free edition.

    While Analytica doesn’t run on macOS, it does work with Parallels or VMWare through Windows.


      Analytica Cubes Pattern