|
Re: Gracefully Handle Bad DB Login [message #786618 is a reply to message #785210] |
Mon, 30 January 2012 16:42 |
|
Mike,
This is a difficult one that either requires you modify the viewer or
use some client side script to modify the errors or auto forward to a
different page. If you want to auto forward you could do something like
the following. Add a script similar to the following to the table that
uses the query's oncreate:
var taskid =
reportContext.getHttpServletRequest().getAttribute("attributeBean").getTaskId();
var mytask =
reportContext.getHttpServletRequest().getSession().getAttribute("tasks").get(taskid).getTask();
if( !mytask.getErrors().isEmpty() ){
//you could iterate the errors here as well
reportContext.setGlobalVariable("myerrors",true);
}else{
reportContext.setGlobalVariable("myerrors", false);
}
then add a text element to the bottom of the report that has the
following content (Make sure to set its type to html):
<script type="text/javascript">
function forward() {
var temp = new String(location.href);
//put location to error page
location.replace("http://www.google.com");
return false;
}
if( <VALUE-OF>reportContext.getGlobalVariable("myerrors");</VALUE-OF> ){
forward();
}
</script>
Jason
On 1/28/2012 12:07 PM, Mike Schlossberg wrote:
> Hi All,
>
> I was wondering if anyone knows of a way to gracefully handle DB login
> errors from the BIRT viewer in order to display a user-friendlier 'bad
> login' message back to the user (and replacing the less friendly
> messages I've reproduced below).
>
> For the particular case I'm working on, the login credentials are being
> passed to BIRT via parameter prompts at runtime.
>
> Thanks for any help you can provide w/ this.
>
> *********************************************
>
> Error using 'frameset':
>
> The following items have errors:
>
> Table (id = 935):
> - Can not load the report query: 935. Errors occurred when generating
> the report document for the report element with ID 935. (Element ID:935)
>
> Error.ReportQueryLoadingError2 ( 1 time(s) )
>
> *********************************************
>
> Error using 'preview':
>
> Table (id = 935):
> - An exception occurred during processing. Please see the following
> message for details:
> Cannot open the connection for the driver:
> org.eclipse.birt.report.data.oda.jdbc.
> org.eclipse.birt.report.data.oda.jdbc.JDBCException: There is an error
> in get connection, ORA-01017: invalid username/password; logon denied
> (Element ID:935)
|
|
|
|
Powered by
FUDForum. Page generated in 0.03328 seconds