Setting database logon information

Once a properly initialized ConnectionInfos object has been created, the database logon information can be passed to the viewer. The viewer handles the process of passing this information to the report.

To set the database logon information
  1. Create an instance of the viewer, passing it a reference to a report source object.
  2.     CrystalReportViewer viewer = new CrystalReportViewer();

        viewer.setReportSource(reportSource);

  3. Set the database logon information by passing the viewer the initialized ConnectionInfos object.
  4. You can disable database prompting to automatically use the set database logon value. This is particularly useful if the database logon being set is unknown to the user.

        viewer.setEnableLogonPrompt(false);  

        viewer.setDatabaseLogonInfos(connInfos);

  5. When setting database logon information for the first time, you don't need to call the refresh method. If your report already has database logons set, then call the viewer's refresh method to apply the logon information.
  6.     viewer.refresh();

  7. If the page contains only the viewer, call its setOwnPage method and pass in true. This allows the viewer to automatically perform page configuration and enables the print and export buttons. If the page contains elements other than the viewer, the setOwnPage method must be called with false and you need to manually set the content-type.
  8. Note:    Setting setOwnPage to false disables exporting and printing.

    viewer.setOwnPage(true);

  9. Call the processHttpRequest method to launch the viewer in the current browser window.
  10. viewer.processHttpRequest(request, response, getServletConfig().getServletContext(), null);



Business Objects
http://www.businessobjects.com/
Support services
http://www.businessobjects.com/services/support/