Arsip: [Help] - Prevent Aplication Hang using Zeos->MySQL

 
user image
more 12 years ago

rydz™

I`m using Delphi 7 and using Zeos VCL to connect to mySQL server, now i would like to know how to prevent my application from 'hanging' while mySQL connection is losses.. How can i handling our Exception Errors While my server SQL is losses? Any one can help me? Please..
user image
more 12 years ago

ImanD

Zeoss VCL version...?
user image
more 12 years ago

mat_koder

sekedar berbagi pengalaman: dulu pernah bikin semacam remote replication ke MSSQL dengan zeos ( bukan mySQL) dan bisa koq handling connection loss ( dalam hal ini koneksi radio/wireless yg bermasalah ) dengan baik. potongan kodenya :

    except
      on E: Exception do
      begin
        s := UpperCase(E.Message);
        if (Pos('CONNECTION FAILURE', s) > 0) then
        begin
          RemoteServerStatus := False;
          RecordStatusToDB('', STAT_CON_FAILURE, True);
        end
        else if (Pos('DOES NOT EXIST', s) > 0) then
        begin
          RemoteServerStatus := False;
          RecordStatusToDB('', STAT_CON_DOWN, True);
        end
        else
          RecordStatusToDB(E.Message, STAT_OTHER, True);
        try
        qryRemote.Connection.Rollback except
        end;
      end;
user image
more 12 years ago

rydz™

Thz guyz for reply... im using ZEOSDBO-6.6.2-rc and i would like to know how can i prevent my application from ' crash ' / ' hanging ' while connection to my server is losses.. Im connect to server mySQL with using Form Login that user can input their information such as localhost,user and so password, Form:: Server Login :: Localhost : port: User: Password: Database: [?-ask-?mat_koder] Which form that can i put your code ?
user image
more 12 years ago

mat_koder

[?-ask-?mat_koder] Which form that can i put your code ?
you can put it in within any code which deal with database ( such as connecting (open db) ,inserting, updating) for an example:

try
 // try open the database connection
  MyConnection.Active := True;
  ...
  check if the user/password combination is exist
  ...
  bla..bla
   ...
except
  .... your exception's handler
end;
user image
more 12 years ago

rydz™

Thx a lot to >>mat_koder<<
more ...
  • Pages:
  • 1
Share to
Local Business Directory, Search Engine Submission & SEO Tools FreeWebSubmission.com SonicRun.com