Login Credentials and Authentication¶
Before deploying your application, you need to decide how users will authenticate to the SQL database. BTR2SQL supports several authentication strategies, each with different trade-offs for security, convenience, and manageability. The right choice depends on whether you are a software vendor shipping a product to customer sites or an in-house team managing your own environment.
Authentication Strategies¶
Windows Trusted Connection (MS SQL Only)¶
The simplest approach for in-house MS SQL Server deployments is to use Windows Authentication (also called a trusted connection). With this method, the driver authenticates to SQL Server using the Windows identity of the user running the application — no username or password needs to be stored in any configuration file.
To enable this, set UseTrustedConnection=yes in the mds.ini file:
[SQL_BTR]
Server=myserver\sql2022
Database=appdb
UseTrustedConnection=yes
When trusted connections are used, the User and Password settings in mds.ini are ignored.
Requirements:
Each Windows user who runs the application must have a corresponding SQL Server login with appropriate read/write permissions on the target database.
This is typically managed through Active Directory groups mapped to SQL Server roles, so that permissions are granted automatically when a user is added to the appropriate AD group.
Advantages:
No passwords to store, encrypt, or rotate.
Each user’s database activity is logged under their own identity, providing a clear audit trail.
Integrates naturally with existing Active Directory infrastructure.
Considerations:
Requires that your SQL Server and Active Directory are configured to support Windows Authentication for every application user. This setup is intentional and requires coordination with your database and network administrators.
Not available for Oracle or PostgreSQL backends.
Per-User Database Credentials¶
BTR2SQL also supports configurations where each user authenticates to the database with their own username and password. There are several ways to accomplish this:
Mertech Login Dialog
If the driver cannot determine credentials at startup — because no User/Password is configured in mds.ini or the INT files, and UseTrustedConnection is not set — it displays a built-in login dialog box prompting the user for server, username, and password. This is the same dialog shown during migration (see Login to the target database).
This approach is uncommon in production deployments, but it can be useful during development or in environments where each user must authenticate individually.
Programmatic Login (B_SQL_LOGIN)
Applications can suppress the built-in dialog and perform the login programmatically using the B_SQL_LOGIN extended API call. This allows the application to present its own login UI and pass the credentials to the driver at runtime. See the SDK documentation for details on the B_SQL_LOGIN operation.
Some customers use this approach to integrate database authentication into their application’s existing login workflow, so the user experiences a single sign-on rather than a separate database login prompt.
Advantages:
Each user’s database activity is logged under their own identity.
Credentials are not stored in configuration files on disk.
Considerations:
Requires each user to have a database login, which adds administrative overhead.
The application (or user) must supply credentials at startup, which may not be desirable in all environments.
Windows Credential Manager Storage¶
For deployments where you want each user to control their own password without the software vendor managing a shared secret, BTR2SQL supports storing the database password in Windows Credential Manager. Only a hex reference to the stored credential is placed in the mds.ini or INT file — the actual password is retrieved from Credential Manager at runtime.
[SQL_BTR]
Server=myserver\sql2022
Database=appdb
User=app_dbuser
Password=02636F6D2E6D6572746563682E67686768
The 02 prefix indicates a Credential Manager reference. See MdsEncryptPassword for details on generating the reference value and the StoreCredential.ps1 script.
Advantages:
The password is protected by Windows security mechanisms and is tied to the current user’s Windows account.
No encrypted password is stored in the configuration file — only a reference.
Individual users can update their own password through Windows Credential Manager without modifying application configuration files.
Considerations:
Each machine (and user profile) must have the credential stored in Credential Manager before the application can connect.
Deployment requires an additional step to populate the credential store, typically via a setup script.
Choosing the Right Strategy¶
Strategy |
Best For |
Backends |
Audit Trail |
Complexity |
|---|---|---|---|---|
In-house MS SQL deployments with Active Directory |
MS SQL only |
Per-user |
Low |
|
Software vendors; multi-backend deployments |
All |
Shared identity |
Low |
|
Environments requiring individual accountability |
All |
Per-user |
Medium |
|
User-managed passwords; enhanced security |
All |
Per-user |
Medium |
See also
mds.ini File for connection and credential configuration.
MdsEncryptPassword for password encryption and Credential Manager integration.
Software Vendor vs. In-House Deployment for broader deployment planning.