Hi,
What's the best way to check if a database server/database is available BEFORE making a connection?
Best way to check if database server available
-
- Posts: 7
- Joined: Sat 06 Jan 2018 15:37
-
- Posts: 7
- Joined: Sat 06 Jan 2018 15:37
Re: Best way to check if database server available
Nobody a solution ?
-
- Posts: 50
- Joined: Tue 25 Jan 2005 11:22
- Location: Somerville, MA
- Contact:
Re: Best way to check if database server available
What is your purpose in doing this?
Re: Best way to check if database server available
Unfortunally, MySQL does not support the ability to know if a server is available without trying to connect to it, so MyDAC does not support this functionality either.
Kindly note that you can use the following code to solve your issue:
Kindly note that you can use the following code to solve your issue:
Code: Select all
try
MyConnection1.Connect;
except
on E: EMyError do
if EMyError(E).ErrorCode = 2003 then
ShowMessage('Can''t connect to MySQL server -' + MyConnection1.Server + #13#10);
else
raise;
end;