Jump to content

How to use another jdbc connection for subreport?


pbrown

Recommended Posts

Hello

 

How can I use in the subreport another jdbc connection than in the masterreport?

 

I've set up two jdbc connection in iReport:

jdbcconnection1: connecting to an oracle db

jdbcconnection2: connecting another db

 

The master report should use jdbcconnection1

The subreport should use jdbcconnection2

 

My configuration uses always the same jdbc connection for master and subreport. How can I use different jdbc connection for the subreport?

 

I tried "use another connection": $P{REPORT_CONNECTION}.

This also seams to use jdbc connection from the masterreport.

Can I specify here another jdbc connection? How?

 

Thanks

Post edited by: pbrown, at: 2007/11/23 06:09

Link to comment
Share on other sites

  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

Don't think you'll get an answer here mate. Have been trying to find this out for over 2 weeks now and nothing. The iReports documentation isn't any help either.

Have tried every formation of connection string and alias I can think of and it will not accept anything. If it showed me the value it is placing in its built in connection parameter/variable that would help.

 

Hope you have better luck than I have.

Link to comment
Share on other sites

The built-in parameter $P{REPORT_CONNECTION} gives a clue to what the app is expecting (java.sql.Connection). So make an iReport parameter to represent the OTHER connection/database you want the subreport to use. Then drop the $P into the subreport connection properties box.

 

specifically in your main report that holds the subreport:

[add-modify papameter/default value expression/new]

parameter name: subConnSybase01DEV

parameter class type: java.sql.Connection

default value expression: java.sql.DriverManager.getConnection("jdbcybase:Tds:localhost:49152/sybase01dev", "dba", "sql")

 

[subreport/properties/subreport tab]

Connection/Datasource Expression: Use connection Expression

paste parameter in bottom box: $P{subConnSybase01DEV}

 

**no clue how to turn off emoticons so the 'dizzy' is a colon s

Post edited by: momzilla, at: 2007/12/04 02:27

Link to comment
Share on other sites

Thank you! This information should be in the manual

 

First I got an error that the driver class is unknown,

but after adding another parameter of type java.lang.Class before, with value Class.forName( "odbc.oracle...") it worked fine.

But is there a better place for this?

Link to comment
Share on other sites

  • 1 month later...
  • 6 years later...

multiple connection working in ireport but when deployed in jasper server not getting records (gives the no data output)


In main report I as using oracle data connection 


and in supreport  I am passing postgre datasource connection as "use a connection":


Set the Connection expression in subreport to:


com.jaspersoft.ireport.designer.utils.Misc.getConnection("postgre")


Now It is working in ireport viewer,but when deployed in jasper server the output shows as blank.


can Anyone help.


Link to comment
Share on other sites

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...