MySQL different exception for hosntame and username ? lazarus / 16-Databases ---------------------------------------------------------------------- mirce.vladimirov · 2017-04-20 14:37 I'm using this code to login to a MySQL server : Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   try    MySQL50Connection1.Connected:=true;  except      on E : Exception do        if E is EDatabaseError  then            showmessage('Unknown hostname or username:' + E.Message)          else            showmessage('Error: ' + E.ClassName + sLineBreak +  '  message is: ' + E.Message);  end;  This way I cant tell what was wrong, the hostname or the username, the error message is always the same: "Server connect failed". Is there a possibility to get the exact reason of the failure: hostname unknow, username unknown ? Thanks ---------------------------------------------------------------------- Leledumbo · 2017-04-20 19:17 Instead of EDatabaseError, try handling ESQLDatabaseError. That one has ErrorCode field (DBMS specific) which can describe what error you get. Consult MySQL documentation for the list. ---------------------------------------------------------------------- mirce.vladimirov · 2017-04-20 20:16 This is what I get Quotenajava.pas(119,14) Error: Identifier not found "ESQLDatabaseError" when I try to compile this Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   try    MySQL50Connection1.Connected:=true;  except    // will only be executed in case of an exception      on E : EDatabaseError do           showmessage('Unknown server or username :' + E.ClassName + sLineBreak +  ' message is: ' + E.Message) ;      on e : ESQLDatabaseError do            showmessage('nn:' + E.ClassName + sLineBreak +  ' message is: ' + E.Message) ;      on E : Exception do            showmessage('Error: ' + E.ClassName + sLineBreak + 'a:' + LineEnding + ' message is: ' + E.Message);         edit_ime.SetFocus;         exit;      end; ---------------------------------------------------------------------- Leledumbo · 2017-04-21 07:02 Quote from: mirce.vladimirov on April 20, 2017, 10:16:04 pmThis is what I get http://www.freepascal.org/docs-html/fcl/sqldb/esqldatabaseerror.html