i want to change MyConnection1.Password but ...

i want to change MyConnection1.Password but ...

Postby iqprog » Mon 29 Nov 2004 22:31

Hi,

MyConnection1.Password := 'mypassword';
MyConnection1.Connected := True;
MyConnection1.Password := ''; // <== MyConnection1 automatic disconnected.

i want to change MyConnection1.Password but I don't want to
MyConnection1 disconnected;

sorry my english little.

thanks.

best regards.
iqprog
 

Postby optima » Tue 30 Nov 2004 08:36

What exactly do you want to do?

If you want the user password to be changed on the MySQL server, use a TMyCommand component linked to your connection and execute the following SQL:
MyCommand.SQL.Text :=
'SET PASSWORD = PASSWORD('''+NewPassword+''')';
MyCommand.Execute;

I hope this helps.
optima
 
Posts: 1
Joined: Tue 30 Nov 2004 08:28

thanks but this is not my problem and solution

Postby iqprog » Tue 30 Nov 2004 09:31

i am not want to user password.

i want to Password property of MyConnection Component.
but when i changed password property, if MyConnection.Connected then MyConnection auto disconnected but i don't want disconnected.

sorry little english.

thanks

best regards.
iqprog
 

Re: i want to change MyConnection1.Password but ...

Postby Ikar » Tue 30 Nov 2004 09:33

Changing MyConnection.Password property has no sense for the established connection.
Ikar
 
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

please try example, Ikar

Postby iqprog » Tue 30 Nov 2004 14:36

thanks Ikar
but....
try please example.

procedure TForm1.Button1Click(Sender: TObject);
begin
MyConnection1.Password := 'mypass';
MyConnection1.Connected := True;
// ok no problem

if MyConnection1.Connected then
showmessage('connection ok.') // ok no problem
else
showmessage('not connection');

MyConnection1.Password := '';

if MyConnection1.Connected then
showmessage('connection ok.')
else
showmessage('not connection'); // PROBLEM
end;

i want to change password and i want to not disconnect.

i want to security.
this solution for security.

because hack programs viewing component properties.

thanks.

best regards.
iqprog
 

Re: please try example, Ikar

Postby Ikar » Thu 02 Dec 2004 07:39

To store a password in source code is unsafe, regardless where you put it - .dfm or .pas files. The best choice for security reasons is probably to ask user for password.

What does not suit you in behavior where a connection is reestablished?
Ikar
 
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Postby iqprog » Fri 03 Dec 2004 16:37

dear IKAR,

i do not store the password in .dfm or .pas

my problem is after the connection, i want to make this: MyConnection1.Password:=''

but when use this MyConnection1.Password:='' , MyConnection1 disconnect automatically.

after i get the password from user and establish the connection, i want to clean the value of object password property.

example in my last reply was sent explain to my problem. if you run that codes you can understand what i try to say.

Thanks,
iqprog
 

Postby Ikar » Mon 06 Dec 2004 15:48

In our opinion, clearing of the password after establishing a connection has no sense. If malicious program can get access to address space of the application, it doesn't make sense how much time the password is available.
Ikar
 
Posts: 1693
Joined: Thu 28 Oct 2004 13:56


Return to MySQL Data Access Components