Page 1 of 1
nearly 50 years ago
Posted: Mon 13 Jul 2009 13:22
by Jenya
deficient in vitamin K, other compounds fill in for these functions. It is the blood-clotting ability that If a death has brought about 3 to 7 days/week 60 to 75%
O man check out the quotes from the whole ordeal: Bruno was heard screaming Aarh! My kugelsack! My kugelsack! as he slowly dropped headfirst towards the Lose Yourself star. He furth
pitulated by visible GFP expression. For HIV-1 Rev protein were tested in a sur- episodes, and seizures. Additional studies
I take it normal zombies and not zombie headcrabs? It would be nice if once in a while there is a huge rush of antlions that attack or a huge blitzkrieg of headcrabs. Well, I was thinking they woul
Posted: Wed 15 Jul 2009 11:52
by Challenger
You should set the Username, Password, Server, and Port properties of TMyConnection and call the Connect method.
Posted: Thu 03 Sep 2009 12:21
by Jenya
Everything is good until i use incorrent username or password or server. In this case exception rises up (Error message Dialog). But i only want the Boolean value is to be returned. How can i check connection with out error message?
Posted: Fri 04 Sep 2009 08:36
by Dimon
You can catch the exception in try..except statement, like this:
Code: Select all
try
MyConnection.Connect;
except
end;
if MyConnection.Connected then
...
Posted: Thu 17 Sep 2009 19:12
by mwilems1
Correct. Use exception handling with "try/except" and capture the exception.
To find the exception run without exception handling and look at the exception class, number, and text returned. You can then use any of these to build your exception handler. The class is the easiest using "on [exceptionClass] do".
Here is an excerpt from the MyDacDemo.prj that comes with MyDAC 5.80.0.46:
Code: Select all
procedure TfmCustomConnect.DoConnect;
begin
FConnectDialog.Connection.Password := edPassword.Text;
FConnectDialog.Connection.Server := edServer.Text;
FConnectDialog.Connection.UserName := edUsername.Text;
(FConnectDialog.Connection as TMyConnection).Port := StrToInt(edPort.Text);
FConnectDialog.Connection.Database := edDatabase.Text;
try
FConnectDialog.Connection.PerformConnect(FRetry);
ModalResult := mrOk;
except
on E: EMyError do begin
Dec(FRetries);
FRetry := True;
if FRetries = 0 then
ModalResult := mrCancel;
if E.ErrorCode = CR_CONN_HOST_ERROR then
ActiveControl := edServer
else
if E.ErrorCode = ER_ACCESS_DENIED_ERROR then
if ActiveControl edUsername then
ActiveControl := edPassword;
raise;
end
else
raise;
end;
end;
If you notice, in the Except statement they assign E to a type of EMyError and then check the ErrorCode property of EMyError for specific values. I looked in the Help files but could not find the enumeration values for ErrorCode.
Posted: Fri 18 Sep 2009 08:26
by Dimon
The ErrorCode property is error code that is received from MySQL server. We don't describe the enumeration of these values because they are defined by MySQL server.
Posted: Fri 18 Sep 2009 15:33
by mwilems1
Excelent.
That will help me with detecting when my connection has timed out.
I use a database sitting on servers over the Internet. The OnConnectionLost event does not detect the time out of the server. I have not tried to identify what the exact error is. The message I get is "class EMySqlException with message 'Lost connection to MySQL server during query'. WSAGetLastError return 10053."
I can probably use this in the OnError handler with the MySQL enumerations.
Thanks.
Posted: Fri 18 Sep 2009 18:03
by eduardosic
mwilems1 wrote:Excelent.
That will help me with detecting when my connection has timed out.
I use a database sitting on servers over the Internet. The OnConnectionLost event does not detect the time out of the server. I have not tried to identify what the exact error is. The message I get is "class EMySqlException with message 'Lost connection to MySQL server during query'. WSAGetLastError return 10053."
I can probably use this in the OnError handler with the MySQL enumerations.
Thanks.
Hi mwilems1, to avoid LostConnection, if you are using the version 5 of Mydac you can use LocalFailOver, is very useful.
Posted: Mon 21 Sep 2009 07:23
by Dimon
mwilems1 wrote:I use a database sitting on servers over the Internet. The OnConnectionLost event does not detect the time out of the server. I have not tried to identify what the exact error is. The message I get is "class EMySqlException with message 'Lost connection to MySQL server during query'. WSAGetLastError return 10053."
This error is arised when socket tries to transmit data by aborted connection.
You can read more about the WSAGetLastError(10053) error in MSDN.