||Re: Connection string in ADODatabase
||Tue, 20 Oct 2020 14:09:54 +1000
On 19/10/2020 20:31, Mustansir Ghor wrote:
> Dear all
> Can we put connection string of ADODatabase in an INI file
You can (see example hereunder), but it is not a very secure thing to do
because the password is stored as plain text in an INI file. Anyone with
access to the folder can get to see it.
My preferred way is to create a custom datamodule (.CDM) that only has
the database connection details. Then every query/report/form that needs
the database connection just requires a simple datamodule to add the
query details (possibly with params to change selection at runtime).
Once compiled, the password becomes invisible in the EXE file.
Should you want to change the connectionstring later, just update the
CDM file with the new database connection string, compile it and drop
the CDO file in the same folder as the EXE file. The change will be
effective instantly to all users from that moment onward and it will
have priority over the CDO object inside the EXE file for program execution.
Persist Security Info=True
User ID=<user name>
Extended Properties="Driver=MySQL ODBC 8.0 ANSI Driver