Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


BO SDK Crystal Report

BO SDK Crystal Report

BO SDK Crystal Report

Hello All,

I am new to this group . I am presently working on BO SDK which uses crystal report(*.rpt ).
The BO team here creates a report and give us the *.rpt file which we export to pdf or csv.The report fetches data from DB. The BO team is saying that the report connects to DB and execute query just we have to pass parameters.
I am setting parameters to my report but it is not working saying ReportSDKException
Error finding JNDI name (DNY08600)---- Error code:-2147467259 Error code name:failed
package poc.sdk;

//Crystal Java Reporting Component (JRC) imports.
//import com.crystaldecisions.sdk.occa.report.application.ReportClientDocument;
import com.crystaldecisions.reports.queryengine.Session;
import com.crystaldecisions.reports.sdk.*;
import com.crystaldecisions.sdk.occa.report.lib.*;
import com.crystaldecisions.sdk.occa.report.data.*;
import com.crystaldecisions.sdk.occa.report.exportoptions.ReportExportFormat;

//Java Imports.
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.*;

public class ReportParameterPassing {

private static final String REPORT_NAME = "C:\\rptfiles\\Test.rpt";
private static final String EXPORT_FILE = "myExportedReport.pdf";
private static final String EXPORT_LOC = "C:\\rptfiles\\pdf\\";

public static void launchApplication() {

try {

// Open report.
ReportClientDocument reportClientDoc = new ReportClientDocument();

reportClientDoc.open(REPORT_NAME, 0);

// We will be using the ParameterFieldController quite a bit
// through-out the rest of this function.
ParameterFieldController paramFieldController = reportClientDoc.getDataDefController().getParameterFieldController();


String[] paramValue1 = { "DSO" };
String paramName1 = "Party Name";

// Using Multiple Parameters
Object[] paramObj1 = new Object[paramValue1.length];

for (int i = 0; i < paramValue1.length; i++) {
paramObj1[i] = new Object();
paramObj1[i] = paramValue1[i];
// Limiting the Report with Parameters
paramFieldController.setCurrentValues("", paramName1, paramObj1);

String[] paramValue2 = { "BP Corp North America Inc" };
String paramName2 = "Party Legal Name";
// Using Multiple Parameters
Object[] paramObj2 = new Object[paramValue2.length];

for (int i = 0; i < paramValue2.length; i++) {
paramObj2[i] = new Object();
paramObj2[i] = paramValue2[i];
// Limiting the Report with Parameters
reportClientDoc.getDataDefController().getParameterFieldController().setCurrentValues("", paramName2, paramObj2);


for (int i = 0 ; i < reportClientDoc.getDataDefController().getDataDefinition().getParameterFields().size();i++)
IField if1 = reportClientDoc.getDataDefController().getDataDefinition().getParameterFields().getField(i);
System.out.println("Creating A DataSource0..." + if1.getDescription());
System.out.println("Creating A DataSource0..." + if1.getType());
System.out.println("Creating A DataSource1..." + if1.getName());
System.out.println("Creating A DataSource2..." + if1.getHeadingText());

// Exporting the Report

System.out.println("Exporting the Report...");
ByteArrayInputStream byteArrayInputStream = (ByteArrayInputStream) reportClientDoc

// Writing To Disk
System.out.println("Writing To Disk...");

// Exported Report location
System.out.println("Exporting to " + EXPORT_OUTPUT);

// Write To File

writeToFileSystem(byteArrayInputStream, EXPORT_OUTPUT);

System.out.println("Writing to Disk Completed");


} catch (ReportSDKException ex) {
} catch (Exception ex) {

private static void writeToFileSystem(
ByteArrayInputStream byteArrayInputStream, String eXPORT_OUTPUT) {
// Writing The File
System.out.println("Writing the File...");
try {
// Use the Java I/O libraries to write the exported content to the
// file system.
byte byteArray[] = new byte[byteArrayInputStream.available()];

// Create a new file that will contain the exported result.
File file = new File(eXPORT_OUTPUT);
FileOutputStream fileOutputStream = new FileOutputStream(file);
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(
int x = byteArrayInputStream.read(byteArray, 0,
byteArrayOutputStream.write(byteArray, 0, x);
// Close streams.
} catch (IOException e) {

public static void main(String[] args) {

but when I am creating the connection and adding below lines before passing parameters it is working fine :

for (int i = 0; i < dbTables.size(); i++) {

String tableAlias = reportClientDoc.getDatabaseController()

System.out.println("oldAlias 1111 >>>>>"
+ dbTables.getTable(i).getName());

//String qu1 = ""
String query = "select * from " + dbTables.getTable(i).getName();
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(query);

results.put(tableAlias, rs);


// Setting the DataSource in Report
final Enumeration<String> aliasEnumeration = Collections
while (aliasEnumeration.hasMoreElements()) {
String oldAlias = aliasEnumeration.nextElement();
System.out.println("oldAlias >>>>>" + oldAlias);
ResultSet rs = results.get(oldAlias);

I just need to Ask if BO people is creating connection and executing query why I have to set result set to report datasource.

RE: BO SDK Crystal Report

Please do not cross-post.

DecisionFirst Technologies - Six-time SAP BusinessObjects Solution Partner of the Year

RE: BO SDK Crystal Report

Sorry .

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close