Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB General » View Thread |
Messages 1 to 2 of 2 total |
Handling DBEngine, DBSession and DBDatabase connection |
Thu, Feb 12 2015 4:39 PM | Permanent Link |
Trinione | Hi:
What is the best/suggested way to handle connection to ensure any issues are caught and reported gracefully to the user? Starting with the DBEngine, what if it is not started or not found. Then, if the DBEngine is found, checking for the Session. Then, if those are fine - ensuring that the DBDatabase is fine. Trinione |
Fri, Feb 13 2015 3:00 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Trinione
>What is the best/suggested way to handle connection to ensure any issues are caught and reported gracefully to the user? > >Starting with the DBEngine, what if it is not started or not found. >Then, if the DBEngine is found, checking for the Session. >Then, if those are fine - ensuring that the DBDatabase is fine. I don't know about others but I don't specifically start / open / set active true for the engine, session or database. I simply set properties and start opening tables. If the engine isn't found it means that someone has hacked your code - don't report this gracefully go in with an Uzi On the other hand, if you mean the server, then the process below should work. Overall if you want to go through the hirearchy the best approach is to 1) set all the necessary properties and then try to login 2) use the OnLogin / OnLogMessage events to see if you've been successful eg in my app I have except on E: Exception do begin if (E is EEDBError) then begin case EEDBError(E).ErrorCode of 504: ShowError('504: Maximum connections exceeded'); 1100: ShowError('1100: Unable to establish remote logon'); else ShowError('Invalid System Code, User ID or Password'); end; end else ShowError('Invalid System Code, User ID or Password'); end; in a try except block 3) Once you're logged in you can query the configuration database (eg select * from configuration.databases) which will give a list of what databases should be there and you can iterate through and test for the path being valid and the catalog file being there making sure that if you've customised things you use your file name. 4) You can then run a validate query on all the tables to make sure they're OK and do any other checks that you think are necessary. The reason I don't suggest itatating through and checking that table files exist on disk is that they may not. Table files are only created from the information in the catalog when they are first used. Roy Lambert |
This web page was last updated on Sunday, May 5, 2024 at 10:18 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |