Access database.

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
prauss
Posts: 3
Joined: Sun 17 Sep 2017 19:27

Access database.

Post by prauss » Sun 17 Sep 2017 19:38

I try to change a password for an existing access database but there are problems with it.
At first I tried to use command ALTER database .... but there was a problem with not recognisation of SQL syntax text (there appeared a message, saying that I can use only following commands : DELETE, INSERT, PROCEDURE, SELECT and UPDATE).

Then I find out, that in order to change password I have to have ExclusiveLock rights. I found such possibility in UniConnection>SpecificOptions>SpecificLock> and I changed this property to "True". But in this case my application hangs running out or there appeared a message, saying that there is wrong password, ... but I know, it is ok.

Which is the best and easiest way to change password for an existing access database (using UNIdac).

Thanks for ane suggestions.

MaximG
Devart Team
Posts: 1822
Joined: Mon 06 Jul 2015 11:34

Re: Access database.

Post by MaximG » Tue 19 Sep 2017 07:36

To use the SQL query "ALTER DATABASE PASSWORD ...", when working with Microsoft Access DB using UniDAC, you should use the 'ExtendedAnsiSQL' option :

Code: Select all

  ...
  UniConnection.SpecificOptions.Values['ExtendedAnsiSQL'] := 'True';
  UniConnection.SpecificOptions.Values['ExclusiveLock'] := 'True';
  UniConnection.Password := 'currentpassword';
  UniConnection.Connect;
  UniConnection.ExecSQL('ALTER DATABASE PASSWORD newpassword currentpassword');
  ...

prauss
Posts: 3
Joined: Sun 17 Sep 2017 19:27

Re: Access database.

Post by prauss » Sun 24 Sep 2017 15:42

Thanx, it works .. :D
MaximG wrote:To use the SQL query "ALTER DATABASE PASSWORD ...", when working with Microsoft Access DB using UniDAC, you should use the 'ExtendedAnsiSQL' option :

Code: Select all

  ...
  UniConnection.SpecificOptions.Values['ExtendedAnsiSQL'] := 'True';
  UniConnection.SpecificOptions.Values['ExclusiveLock'] := 'True';
  UniConnection.Password := 'currentpassword';
  UniConnection.Connect;
  UniConnection.ExecSQL('ALTER DATABASE PASSWORD newpassword currentpassword');
  ...

MaximG
Devart Team
Posts: 1822
Joined: Mon 06 Jul 2015 11:34

Re: Access database.

Post by MaximG » Mon 25 Sep 2017 08:15

We are glad to see the problem resolved. Please don't hesitate to contact us with questions concerning UniDAC usage.

Post Reply