Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » Gracefully Handle Bad DB Login
Gracefully Handle Bad DB Login [message #785210] Sat, 28 January 2012 17:07 Go to next message
Mike Schlossberg is currently offline Mike SchlossbergFriend
Messages: 12
Registered: January 2012
Junior Member
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)
Re: Gracefully Handle Bad DB Login [message #786618 is a reply to message #785210] Mon, 30 January 2012 16:42 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

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)
icon14.gif  Re: Gracefully Handle Bad DB Login [message #786707 is a reply to message #786618] Mon, 30 January 2012 18:37 Go to previous message
Mike Schlossberg is currently offline Mike SchlossbergFriend
Messages: 12
Registered: January 2012
Junior Member
Jason,

I just tested the redirect and it should be fine for our needs. Actually, I was kind of fumbling around with something similar you had posted before (www.birt-exchange.org/org/forum/index.php/topic/20435-hiding-error-text-from-ui/page__p__68181&), but I wasn't sure how to put it all together. It's all clear to me now, thanks to your concise response.

Thanks again!
Mike
Previous Topic:Date Parameter
Next Topic:Stored Procedure without owner
Goto Forum:
  


Current Time: Thu Dec 18 09:45:55 GMT 2014

Powered by FUDForum. Page generated in 0.02505 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software