cancel
Showing results for 
Search instead for 
Did you mean: 

Test Database connection

Former Member
0 Kudos

A bit of background on our setup. We use crystal reports on our website for our customers to be able to access account history from a database on another server. When that server is down and a user tries to retrieve information, they receive the database logon page.

What can we do to test for that connection before the request is fulfilled? Is there something with crystal inside the report we can do or is this purely a .net issue that we need to pursue?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

In Crystal Report designer you can use Verify database command.When you choose Verify Database from the Database menu, the program checks the active databases and reports. If it detects changes, the report must be adapted to prevent errors.

In .NET you can use

ReportDocument.VerifyDatabase Method

Checks whether the database connection is active for the report that is loaded by the ReportDocument object.The LogOnException error is thrown when the database connections cannot be established, or when the database logon information is incorrect.

Hope this helps!

Sincerely,

Nikhil Dharme

Former Member
0 Kudos

I am aware of the verify database in crystal report designer. That just lets us verify the db during development. I am looking for more of a runtime solution or to be able to capture the event in a way that it does not display the logon credentials if the server is unreachable or there is a db problem. The last thing I want is for users to be able to see that data. The .net solution may help somewhat but I am unsure of where to include that method.

0 Kudos

Hi Tom,

Typically in an application after opening up a report the next step is to set the logon info. At that point your can set the log on info and then test connectivity. Use a try function, if it fails then you can pop up a message box and pass on the info.

Or another option is if you know the Server those users will be connecting to you can add the OLEDB references to your project and before you open a report run a simple query from a test table with one record so it's fast, if it fails then pop up a message box indicating "The DB server you are attempting to use is currently un-available - Please try again later"

Part of your question I believe also has to do with detecting changes to the DB? If you are wanting to use Crystal to detect changes that have been made to the tables CR will do that using the Verify method. Currently though there is no mapping API functionality and CR simply removes any fields/tables that we can not map automatically. Typically it breaks the reports. So if you plan to make changes you must update your reports manually.

Thank you

Don

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Tom,

Do a small test to test your connection.

-Right Click on desktop ->

Create new text document->

Save as test.UDL->

double click and test connection by selecting driver name,datasource name,user id and password.

Click on Test Connection.

It should be succeed.

I think we receive the database logon page if :

1.Logon code is not written.

2.Database connection /server is down.

Regards,

Shweta