cancel
Showing results for 
Search instead for 
Did you mean: 

passing SQL to Crystal Reports Server using JAVA

Former Member
0 Kudos

Hi all,

We are in the process of redoing our Java app and we would like to create SQL query and pass this to Crystal Reports Server to have it generate a report.

I've looked all over but still could not find any info on it. Does anyone know how this is done or know where I can find some information on this?

I've looked at some of the examples from BO but did not find anything relating to what I need to have.

Thanks in advance.

-S.C.-

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

You would like to create SQL query and pass this to Crystal Reports Server to have it generate a report.

- Is it that you want to query (write a SQL query) the CMS database for the report and then display that particular report.

- Do you need a sample code for doing this.

Please correct me if I am wrong.

Thanks,

Soni

Former Member
0 Kudos

Hi Soni,

Thanks for replying.

Yes, I'll generate an SQL statement with my Java application

(Example: Select first_name, last_name from person_info where last_name = 'SMITH')

and I would like to pass this to Crystal Report Server. The server will have a generic Crystal Report which will accept the SQL and generate a report for users to see.

I'm looking for example code of how this is done. I have not found it on this web site.

Thanks again.

-S.C.-

Former Member
0 Kudos

Hey,

Have a look at https://boc.sdn.sap.com/node/452

There some other great webinars on the left side also.

Hope that helps.

Else if you wanting to run some SQL before loading the report search for something along the lines of:

(But I warn you this is not the correct coding, I have just quickly cut and paste a

few bits from one of my reports but you should get the idea, hopefully,

might have to use your imagination.)


Connection connection = null;
CallableStatement cs;

Class.forName(dbDriverName);
	    
 // Create a connection to the database
connection = DriverManager.getConnection(dbConnectionURL, dbUsername, dbPassword);
	        
// Call a procedure with one IN parameter
cs = connection.prepareCall("{ CALL " + str_ProcStatement + "}");
cs.setString(1, str_Param1);

Former Member
0 Kudos

Hi Darren,

Thanks for replying. I'll check out the link you posted.

As for running an SQL before calling the Crystal Reports Server, that's what we are doing right now. We feel that we should let the Crystal Reports Server do the querying rather than having the Java program do it and pass the result set to Crystal, that's why we are trying to find a way to do this way.

If you have any more suggestions, please feel free to stop by.

Thanks,

-S.C.-

Former Member
0 Kudos

Hi again Darren,

I took a look at the video but it's not what I need.

I need to generate on-the-fly custom SQL and pass it to Crystal Reports Server and have it execute it.

On-the-fly in the sense that the SQL will be generated by my Java application based on the input from the users. The WHERE clause will always be different. Once the SQL is created, Crystal Reports Server should run it and generate the output.

Thanks for your help though,

Anyone else has any suggestions?

TIA

-S.C.-

Edited by: S Chowadee on Oct 21, 2008 8:02 PM