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.

    CrystalReportViewer viewer = new CrystalReportViewer();

    viewer.setReportSource(reportSource);

  2. Set the database logon information by passing the viewer the initialized ConnectionInfos object.

    viewer.setDatabaseLogonInfos(connInfos);

    viewer.setEnableLogonPrompt(false);

  3. Call the processHttpRequest method to launch the viewer in the current browser window.

    viewer.processHttpRequest(request, response, getServletConfig().getServletContext(), null);

  4. Call the dispose method to allow the viewer to perform the appropriate garbage collection and free system resources.

    viewer.dispose();



Crystal Decisions
http://www.crystaldecisions.com/
Support services
http://support.crystaldecisions.com/