Jump to content
We've recently updated our Privacy Statement, available here ×

Report and Subreport with diferent datasource


francesco334

Recommended Posts

Hello,

 

I have my "main" report with XML datasource.

I want to call a subreport that have SQL datasoure.

 

I have read previous post of jesteve, but when I export my main report in txt format, by java code, I have this error :

java.sql.SQLException: No suitable driver

at java.sql.DriverManager.getDriver(Unknown Source)

 

I have create in iReport a parameter with value :

java.sql.DriverManager.getConnection("jdbc:sybase:Tds:192.168.0.12:2638/lmt

", "user", "password")

 

I think that the problem is the driver_name. Where I must define it in the parameter iReport??

 

The files jar of JDBS of Sybase have been copied into lib directory and works fine, testing they from "Connection property" of iReport.

 

this is instead the java code, that deploy the report:

 

String xmlFileName= "c:/basket/SearchBasketRS.xml";

String recordPath = "/SearchBasketRS/Baskets/Basket/Services/Service";

String reportFileName = "C:\Airservices.jasper";

String outFileName = "C:\Airservices.txt";

 

 

JRXMLDataSource jrxmlds = new JRXMLDataSource(xmlFileName,recordPath);

 

HashMap hm = new HashMap();

 

try

{

JasperPrint print = JasperFillManager.fillReport(

reportFileName,

hm,

jrxmlds);

 

JRExporter exporter = new JRTextExporter();

 

Thanks for all your response.

Francesco

 

This is the previous POST of Juan Carlos Esteve of 14/09/2005:

"

By: Juan Carlos Esteve - jesteve

RE: Report and Subreport with diferent datasource

2005-09-14 05:03

OK, I found one solution....

 

First, create a new parameter...

 

Parameter Name: subreportDS (for example..)

 

Parameter class tipe class: java.lang.Object

 

Default value expresion: java.sql.DriverManager.getConnection("jdbc:oracle:thin:@host:1521:dbname", "user", "password")

 

Then... in the subreport dialog ... at "Connection / Datasource expresion" choose "Use connection expresion" and in the texbox...

 

$P{subreportDS} (the parameter name created)

 

Compile and test

 

Bye

 

"

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...