Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Re-connecting to a Database and table after the connection is dropped

Posted on 1998-09-29
1
Medium Priority
?
144 Views
Last Modified: 2011-08-18
Hello All !  I have a Delphi 1.0 app that is running against SQL-AnyWhere 5.5.0.4 Build 1867. The database does not have the -i option set which means the default for that option is in effect: that is, connections that are idle for four hours are disconnected.

But, lets say my user clicks the "refresh" button, five hours after the app has been idle.  Now, they get an error message that says:

"General SQL error [Sybase][ODBC Driver]
Connection not open;not connected to database"

Instead of getting/seeing that message, I want to handle the error and re-connect to the database and tables for the user without them knowing it or seeing it, and I want to refresh the app's data.  Can anyone offer advice?

Everett
0
Comment
Question by:ecrockett
1 Comment
 

Accepted Solution

by:
belgianbasman earned 400 total points
ID: 1341110
Looks like a basic exception handling problem to me.

in the onClick event handler of the refresh button, put the following:

try
   begin
//          Display;
   end;
Except on EDatabaseError do
   begin
//           Disconnect;
//           Connect;
//           Display;
   end;
END;
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Screencast - Getting to Know the Pipeline
Suggested Courses

885 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question