Subject Re: Connection string in ADODatabase
From Gaetano <gaetanodd@hotmail.com>
Date Tue, 20 Oct 2020 14:09:54 +1000
Newsgroups dbase.getting-started

On 19/10/2020 20:31, Mustansir Ghor wrote:
> Dear all
>
> Can we put connection string of ADODatabase in an INI file
>
> Regards
> Mustansir
>


Hi Mustansir,

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.

Cheers,
Gaetano.

[Connections]
1=ADOinINI
[ADOinINI]
Provider=MSDASQL.1
Password=<password>
Persist Security Info=True
User ID=<user name>
Extended Properties="Driver=MySQL ODBC 8.0 ANSI Driver
SERVER=127.0.0.1
UID=<user id>
DATABASE=<database name>
PORT=3307"



Warning: Unknown: write failed: No space left on device (28) in Unknown on line 0

Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct () in Unknown on line 0