Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

TestConnectivity or VerifyDatabase for testing staled DB connection?


We have been using the Crystal Report 2008 .NET APIs in our C++ application (with VS 2005) for a few years. It has the following workflow:

when repport request received:

create a new ReportDocument,

call ReportDocument->Load to load the report

Get user db connection information and put in new TableLogOnInfo

For each table in the report and each table of each subreport

call Table->ApplyLogOnInfo with TableLogOnInfo

call Table->TestConnectivity

setup paramaters ..

call either ReportDocument->ExportToDisk or PrintToPrinter


The above approach has been working fine until one of our customer created a huge report (over 2 MB) with a lot of subreport and tables. The steps of Loading the report and connecting to the DB took a few minutes. So, instead of of closing the report each time and creating a new ReportDocument object, the object is now retained and remained open to avoid the report reloading and db connection steps. The new approach also works fine, except when there is a network interruption between our application and the DB server. The report cannot be printed/exported anymore because the DB connection is staled.

I tried to check the DB connection by calling VerifyDatabase before the actaul print/export operation, no exceptions were thrown even when DB connection was broken. I also tried using TestConnectivity with a table of the ReportDocument, it also did not complain about the DB connection after it was broken. But the subsequent ExportToDisk call would fail.

Are there any methods to detect staled DB connections (I was not able to find appropriate ones from the API referernce, crsdk_net_apiRef_12_en.chm)?


Kin H Chan

Former Member
Not what you were looking for? View more on this topic or Ask a question