cancel
Showing results for 
Search instead for 
Did you mean: 

How to solve these ReportSDKException

Former Member
0 Kudos

Hi

while running these .jsp page on OC4J server I got exception

(com.crystaldecisions.sdk.occa.report.lib.ReportSDKException: PermGen space---- Error code:-2147467259 Error code name:failed )

<%@ page contentType="text/html; charset=UTF-8" pageEncoding="ISO-8859-1" %><%@ page import="com.businessobjects.samples.CRJavaHelper,

com.crystaldecisions.report.web.viewer.CrystalReportViewer,

com.crystaldecisions.sdk.occa.report.application.OpenReportOptions,

com.crystaldecisions.sdk.occa.report.application.ReportClientDocument,

com.crystaldecisions.sdk.occa.report.lib.ReportSDKExceptionBase,

java.sql.Connection,

java.sql.DriverManager,

java.sql.ResultSet,

java.sql.SQLException,

java.sql.Statement" %><%

// This sample code calls methods from the CRJavaHelper class, which

// contains examples of how to use the BusinessObjects APIs. You are free to

// modify and distribute the source code contained in the CRJavaHelper class.

try {

String reportName = "ReportForDAte.rpt";

ReportClientDocument clientDoc = (ReportClientDocument) session.getAttribute(reportName);

if (clientDoc == null) {

// Report can be opened from the relative location specified in the CRConfig.xml, or the report location

// tag can be removed to open the reports as Java resources or using an absolute path

// (absolute path not recommended for Web applications).

clientDoc = new ReportClientDocument();

clientDoc.setReportAppServer(ReportClientDocument.inprocConnectionString);

// Open report

clientDoc.open(reportName, OpenReportOptions._openAsReadOnly);

// ****** BEGIN SET RUNTIME DATABASE CREDENTIALS ****************

{

String connectString = "jdbc:oracle:thin:@192.168.1.67:1521:mdb1";

String driverName = "oracle.jdbc.OracleDriver";

String JNDIName = "mdb1";

String userName = "act_db"; // TODO: Fill in database user

String password = "act_db"; // TODO: Fill in password

// Switch all tables on the main report and sub reports

CRJavaHelper.changeDataSource(clientDoc, userName, password, connectString, driverName, JNDIName);

// logon to database

CRJavaHelper.logonDataSource(clientDoc, userName, password);

}

// ****** END SET RUNTIME DATABASE CREDENTIALS ****************

// ****** BEGIN POPULATE WITH RESULTSET SNIPPET ****************

{

// **** POPULATE MAIN REPORT ****

{

// Connection Info for fetching the resultSet

String connectStr = "jdbc:oracle:thin:@192.168.1.67:1521:mdb1";

String driverName = "oracle.jdbc.OracleDriver";

String userName = "act_db"; // TODO: Fill in database user

String password = "dbpassword"; // TODO: Fill in valid password

// TODO: Ensure this query is valid in your database. An exception will be thrown otherwise.

String query = "SELECT CUSTOMER_NAME FROM APP.CUSTOMER WHERE COUNTRY = 'Australia'";

// As long the Resultset schema has the same field names and types,

// then the Resultset can be used as the datasource for the table

String tableAlias = "HEADER"; // TODO: Change to correct table alias

// Push the Java ResultSet into the report (this will then be the datasource of the report)

CRJavaHelper.passResultSet(clientDoc, fetchResultSet(driverName, connectStr, userName, password, query),

tableAlias, "");

}

}

// ****** END POPULATE WITH RESULTSET SNIPPET ****************

// ****** BEGIN POPULATE WITH POJO SNIPPET ****************

{

// This option is not applicable for the report you have chosen

}

// ****** END POPULATE WITH POJO SNIPPET ****************

// ****** BEGIN CONNECT PARAMETERS SNIPPET ****************

// This option is not applicable for the report you have chosen

// ****** END CONNECT PARAMETERS SNIPPET ****************

// Store the report document in session

session.setAttribute(reportName, clientDoc);

}

// ****** BEGIN CONNECT CRYSTALREPORTPAGEVIEWER SNIPPET ****************

{

// Create the CrystalReportViewer object

CrystalReportViewer crystalReportPageViewer = new CrystalReportViewer();

String reportSourceSessionKey = reportName+"ReportSource";

Object reportSource = session.getAttribute(reportSourceSessionKey);

if (reportSource == null)

{

reportSource = clientDoc.getReportSource();

session.setAttribute(reportSourceSessionKey, reportSource);

}

// set the reportsource property of the viewer

crystalReportPageViewer.setReportSource(reportSource);

// Apply the viewer preference attributes

// Process the report

crystalReportPageViewer.processHttpRequest(request, response, application, null);

}

// ****** END CONNECT CRYSTALREPORTPAGEVIEWER SNIPPET ****************

} catch (ReportSDKExceptionBase e) {

out.println(e);

} catch (SQLException e) {

out.println(e);

}

%><%!

// Simple utility function for obtaining result sets that will be pushed into the report.

// This is just standard querying of a Java result set and does NOT involve any

// Crystal Reports Java SDK functions.

private static ResultSet fetchResultSet(String driverName,

String connectStr, String userName, String password, String query) throws SQLException, ClassNotFoundException {

//Load JDBC driver for the database that will be queried

Class.forName(driverName);

Connection connection = DriverManager.getConnection(connectStr, userName, password);

Statement statement = connection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);

//Execute query and return result sets

return statement.executeQuery(query);

}%>

Regards ;

Amol

Thanx !!!

Accepted Solutions (1)

Accepted Solutions (1)

ted_ueda
Active Contributor
0 Kudos

What happens if you give the Java more PermGen space.

Sincerely,

Ted Ueda

Answers (0)