Subject Re: Connection string in ADODatabase
From MUSTANSIR GHOR <mustan31@hotmail.com>
Date Tue, 20 Oct 2020 08:48:38 -0400
Newsgroups dbase.getting-started

Dear Gaetano

Thank you.

Your solution is perfect

So far I have not used datamodules dmd or cmd. But I will work on it

Thank you once again

Mustansir


Gaetano Wrote:

> 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"
>