Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 1998-09-29
1
Medium Priority
?
143 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

704 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