I developed an application that uses FireDAC to connect to MySQL. But when I try to open it in a station, when the Connected := True
is set, the application is closed, without returning any Exception. I wrapped the code in a try...except
, but it still does not show any error messages. Here is the code I use for the connection
procedure TfrmServidor.confConnection;
begin
with conMySQL do begin
DriverName := LeXML.Strings[5];
Params.Add('Server=' + LeXML.Strings[3]);
Params.Add('Port=' + LeXML.Strings[4]);
Params.Add('Database=' + LeXML.Strings[0]);
Params.Add('User_Name=' + LeXML.Strings[1]);
Params.Add('Password=' + LeXML.Strings[2]);
ShowMessage(Params.Text);
end;
try
conMySQL.Connected := True;
except
on e : Exception do
ShowMessage(e.Message);
end;
end;
Where LeXML
is a function that reads an XML file with the connection properties and returns the values in a TStringList.
what did I do wrong? The ShowMessage
with Params.Text
returns the following:
[Window Title]
Servidor
[Content]
DriverID=MySQL
Server=10.1.1.16
Port=3306
Database=treinamentos
User_Name=treinamentos
Password=masterkey
[OK]
Can anyone help me?