Error Handling using Database Connector

Hello:

I’m using a database connector to handle a set of database operations (inserts, updates, etc) in database tables.

The operations are handled through code, I need to catch SQL errors and handle them in code.

The question is: what are the best practices for handling this kind of errors while using the database connector ? I see that you have a getErrorHandler, setErrorHandler methods in RowSetTableContentProvider that uses an IErrorHandler;
on the other hand you have DbClientErrorHandler class that contains a set of methods to handle this kind of errors.

How you use these methods together ?

Thanks
Edgardo

If you are using RowSetTableContentProvider to run your sql. Then you can add a DbClientErrorHandler bean to your page bean and set binding of RowSetTableContentProvider.errorHandler to point to this error handler bean. Then any error occurred inside provider methods will be delegated to the handler (you can also provider implementation of you own handler via interface).

You can take a look at the /samples/caf/wm_coreproviderstest. Look for view/ErrorHandling folder.

Samples source code is available for download from http://www.ajax-softwareag.com

Thanks Alex:

I used the approach to create a class inside the page bean inheriting DbClientErrorHandler. Then use the handleError method to do the error handling.

It worked nicely
Edgardo