saravanan.navaneethan
December 20th, 2005, 07:30 AM
hi,
I configure the crystal report 10 with jsp.I can call the viewerbean.But i can't create dynamic runtime crystal report.
this is my code.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@page import="com.crystaldecisions.reports.sdk.ReportClientDocument,
com.crystaldecisions.sdk.occa.report.lib.*,
java.sql.*"
%>
<%
/* Applies to Versions: XI
* Date Created: February 2005
* Description: This sample demonstrates how to pass a Java Resultset to a report as a datasource at runtime using the
* (JRC) SDK.
* Author: CW
*/
ReportClientDocument reportClientDocument = new ReportClientDocument();
try {
reportClientDocument.open("/jrc_set_resultset_datasource.rpt", 0);
//SQL query that can be used can be obtained by first creating a report directly off the desired datasource, and then
//in Crystal Reports, open the 'Database' > 'Show SQL Query' to see the SQL generated for the report.
String query = "select * from oddlot";
//Call simple utility function that obtains Java Result set that will be
//pushed into the report.
ResultSet resultSet = getResultSetFromQuery(query, ResultSet.TYPE_SCROLL_INSENSITIVE);
String tableName = reportClientDocument.getDatabaseController().getDatabase().getTables().getTable(0).getName();
//Push the Java Resultset into the report. This will then become the datasource of the report when the report itself
//is generated.
reportClientDocument.getDatabaseController().setDataSource(resultSet, tableName , "resultTbl");
//Cache the report source of the ReportClientDocument in session.
session.setAttribute("reportSource", reportClientDocument.getReportSource());
response.sendRedirect("CrystalReportViewer.jsp");
}
catch(ReportSDKException sdkEx) {
out.println(sdkEx);
}
%>
<%!
/**
* 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 JRC API functions.
*/
private ResultSet getResultSetFromQuery(String query, int scrollType)throws SQLException, ClassNotFoundException {
String url = "jdbc:oracle:thin:@172.20.6.102:1621:ksedb";
String userName = "kse1";
String pwd = "kse1";
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
java.sql.Connection connection=DriverManager.getConnection(url,userName, pwd);
System.out.println("Database Connection established Successfully .........");
//Use JDBC-ODBC bridge to query the Xtreme Sample Database DSN.
//Construct connection to the DSN.
Statement statement = connection.createStatement(scrollType, ResultSet.CONCUR_READ_ONLY);
//Execute query and return result sets.
return statement.executeQuery(query);
}
%>
when i was run this error occured
com/crystaldecisions/reports/reportengineinterface/a/a/b
if anybody met this suituation please help me.
thanx & regards,
N.Saravanan.
I configure the crystal report 10 with jsp.I can call the viewerbean.But i can't create dynamic runtime crystal report.
this is my code.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@page import="com.crystaldecisions.reports.sdk.ReportClientDocument,
com.crystaldecisions.sdk.occa.report.lib.*,
java.sql.*"
%>
<%
/* Applies to Versions: XI
* Date Created: February 2005
* Description: This sample demonstrates how to pass a Java Resultset to a report as a datasource at runtime using the
* (JRC) SDK.
* Author: CW
*/
ReportClientDocument reportClientDocument = new ReportClientDocument();
try {
reportClientDocument.open("/jrc_set_resultset_datasource.rpt", 0);
//SQL query that can be used can be obtained by first creating a report directly off the desired datasource, and then
//in Crystal Reports, open the 'Database' > 'Show SQL Query' to see the SQL generated for the report.
String query = "select * from oddlot";
//Call simple utility function that obtains Java Result set that will be
//pushed into the report.
ResultSet resultSet = getResultSetFromQuery(query, ResultSet.TYPE_SCROLL_INSENSITIVE);
String tableName = reportClientDocument.getDatabaseController().getDatabase().getTables().getTable(0).getName();
//Push the Java Resultset into the report. This will then become the datasource of the report when the report itself
//is generated.
reportClientDocument.getDatabaseController().setDataSource(resultSet, tableName , "resultTbl");
//Cache the report source of the ReportClientDocument in session.
session.setAttribute("reportSource", reportClientDocument.getReportSource());
response.sendRedirect("CrystalReportViewer.jsp");
}
catch(ReportSDKException sdkEx) {
out.println(sdkEx);
}
%>
<%!
/**
* 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 JRC API functions.
*/
private ResultSet getResultSetFromQuery(String query, int scrollType)throws SQLException, ClassNotFoundException {
String url = "jdbc:oracle:thin:@172.20.6.102:1621:ksedb";
String userName = "kse1";
String pwd = "kse1";
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
java.sql.Connection connection=DriverManager.getConnection(url,userName, pwd);
System.out.println("Database Connection established Successfully .........");
//Use JDBC-ODBC bridge to query the Xtreme Sample Database DSN.
//Construct connection to the DSN.
Statement statement = connection.createStatement(scrollType, ResultSet.CONCUR_READ_ONLY);
//Execute query and return result sets.
return statement.executeQuery(query);
}
%>
when i was run this error occured
com/crystaldecisions/reports/reportengineinterface/a/a/b
if anybody met this suituation please help me.
thanx & regards,
N.Saravanan.