Solved

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

Posted on 1998-09-29
1
135 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 100 total points
Comment Utility
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
This video discusses moving either the default database or any database to a new volume.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

743 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now