Additional
dbCAP
AnyDAC
ThinDAC
NCOCI8
Topic: Two important questions
Two important questions
Posted: 2007/07/16 03:43
 
I have two important questions and I need fast reply on them.

First:
Am I able to change host/username/password (configurable directly in ADConnection) through code ? If yes, then how ?

Second:
Friend to whom I gave trial of my application said, that its pretty easy to get from application host/user and other settings. It's just easy to view by everyone who has this application. Regarding to this issue - how do I hide infos about connection settings ? It wouldn't be nice, if everyone could be able to view my database connection settings ...
Re:Two important questions
Posted: 2007/07/17 01:34
 
Hello

1) Am I able to change host/username/password (configurable directly in ADConnection) through code ? If yes, then how ?
See demo AnyDACDEMOComp LayerTADConnectionConnectionDefs.
In general, ADConnection has property Params. And just put parameters, as they are in connection definition in AnyDACDBADConnectionDefs.ini, into Params.

2) You can omit host, username and password from connection definition parameters and use TADGUIxFormsLoginDialog to ask end user this info right before connecting to DB.

Regards,
Dmitry
Re:Two important questions
Posted: 2007/09/10 07:26
 
Hi,

this (security) issue is the same for all delphi-applications: You can easily see the data in any exe-file.

For my application I'm using an external XML-File, adding a TXMLDocument-Object, and putting all the configuration-data there. If you want, you can add an encryption-method there. I can post or send you an example!

Yours,
Alexander
Re:Two important questions
Posted: 2007/09/10 07:48
 
I can post or send you an example!
Send, please.
Re:Two important questions
Posted: 2007/09/12 09:26
 
So there are several parts:

1.) The XML-File comtains the data you want for your configuration. In the XML-Configuration only one level for the data is supported. If you need more levels, you would have to change the GetXMLData funciton in the datamodule

2.) The Datamodule, which contains the XML-Document-Object and several functions which wrappes the data I'm looking for. (cfdata)

3.) In the Datamodule (Maindata), the connection is stored I've inserted an event at "BeforeConnection". Connection is the TADConnection; ModeToUse stores the type of connection (server or client), cfgdata is the Datamodule, which serves the configuration data.



 with Connection.Params do begin     Clear;     Add('DriverID=MSSQL2005');     Add('App=Innervation');     Add('AllowReconnect=True');     with cfgdata do       case ModeToUse of         tcmob begin                   Add('Server=' GetLocalDBInstance);                   Add('Database=' GetLocalDBDatabase);                   if GetLocalDBOsAuthent then                     Add('OSAuthent=Yes')                   else                     Add('OSAuthent=No');                   Add('User_Name=' GetLocalDBUser);                   Add('Password=' GetLocalDBPassword);                 end;         tcsrv:  begin                   Add('Server=' GetServerDBInstance);                   Add('Database=' GetServerDBDatabase);                   if GetServerDBOsAuthent then                     Add('OSAuthent=Yes')                   else                     Add('OSAuthent=No');                   Add('User_Name=' GetServerDBUser);                   Add('Password=' GetServerDBPassword);                 end;       end;   end;


File Attachment:
File name: cfgdata.zip
File size:2547 bytes


Post edited by: Mohr, at: 2007/09/12 10:07