What is the best way to Secure an Access DB with Delphi ?

Just wondering, what is the BEST and easiest way to lock down or secure an MS Access Database, while using Delphi as a Front End.

I basically want to prevent Users from opening an MS Access database via the backend, and let ALL access to be done done via a Delphi front end.

There will also be other security measures via Delphi restricting users from Editing, Viewing certain data.

Environment - Currently Using Windows XP desktops, with Windows 2003 servers and Users are registered / restricted using Active Directory and User Groups.

Also using Delphi 2006 and MS Access 2003
pjeliasAsked:
Who is Participating?
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
Just be aware that the Database Password in Access 2003 or lower can easily be hacked, if that's important to you. The only other option is securing with User Level Security, which is much more difficult (and can still be hacked, although at least the hacker would have to pay a little money for the privilege).
0
 
Simon BallCommented:
set database password.

I have no idea how you would use Delphi to make a front end for access, i always use access....but my back end is usually ODBC to an sql server.

There are workgroups options and set db password options, but i do not know how those will affect your delphi connection to the back end access db...
0
 
Emmanuel PASQUIERFreelance Project ManagerCommented:
Here is Delphi code to login to an access DB with/without password, and set/reset the password .
// declare _Password in your Form, add an ADO Connection
TMainForm=class(TForm)
 ADOConnection1:TADOConnection;
//...
 private
  _Password:String;
//...  
 end;

function TMainForm.ConnectString(Password:String=''):String;
begin
 if Password<>'' 
  Then Result:=Format('Provider=Microsoft.Jet.OLEDB.4.0:Database Password=%s;Data Source="%s";Persist Security Info=False;', [Password,DBPath+'\'+DBName]))
  Else Result:=Format('Provider=Microsoft.Jet.OLEDB.4.0;Data Source="%s";Persist Security Info=False;', [DBPath+'\'+DBName]));
end;

function TMainForm.SetPassword(aPassword: String):Boolean;
Var
 OldPass,NewPass:String;
begin
 if _Password<>'' Then OldPass:='`'+_Password+'`' Else OldPass:='NULL';
 if aPassword<>'' Then NewPass:='`'+aPassword+'`' Else NewPass:='NULL';
 With ADOConnection1 do 
  try
   if Connected Then Close;
   ConnectionString:=ConnectString(_Password);
   Mode:=cmShareExclusive;
   Open;
   Execute('ALTER DATABASE PASSWORD '+NewPass+' '+OldPass);
   Result:=True;
  except
   Result:=False;
  end;
 if Result Then _Password:=aPassword;
 Login(_Password); // reconnect
end;

function TMainForm.Login(Password: string): boolean;
begin
 With ADOConnection1 do 
  try
   if Connected Then Close;
   ConnectionString:=ConnectString(Password);
   Mode:=cmReadWrite;
   Open;  
   Result := ADOConnection1.Connected;
   if Result Then _Password:=Password;
  except
   Result := False;
  end;
end;

Open in new window

0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
Mahdi78Commented:
Set password and encrypt data
0
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
But please note that using standard Access encryption means that once you open the database with that password, all the data is freely available and unencrypted.
0
 
Mahdi78Commented:
So with second encryption, data will be more secure
Remember: encryption slowing database
0
 
zoom2000Commented:
Use the Access Security and Create your MDW through  Security Menu in Access
put your .mdw file beside your database in the same folder
Pass this information when you open the database through Delphi
This is the Best and Most Secured Way
Database password is very weak and many applications on the download u can download it for free ! , will open your database very easily.

0
 
pjeliasAuthor Commented:
How do you pass information to Delphi using mdw File ?

Is this done via the ADOConnection ?

Can you give an example ?
0
 
pjeliasAuthor Commented:
Does the MDW method slow the data access down ?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.