Jump to content
Changes to the Jaspersoft community edition download ×

Subreport different data source, but not hardcoded


k.Herkt

Recommended Posts

I have a main-report with several sub-report.
All sub-reports and the main-report are using the same connection, except ONE sub-report.

I created 2 Data Sources on 'JasperReports Server', but i can only specify ONE data source for the main-report and its sub-reports.
The "bad solution" for this is to manually add a second java.sql.Connection in the main-report.jrxml.

But is there a more safe and dynamic solution, than doing this by hardcoding the db credentials?

http://community.jaspersoft.com/wiki/multiple-datasources-ireport-lists-tables-and-subreports


The "bad solution" in the main-report.jrxml from the provided link:

 

    <parameter name="MS_SQL_CONNECTION" class="java.sql.Connection" isForPrompting="false">        <parameterDescription><![CDATA[java.sql.DriverManager.getConnection("jdbc:sqlserver://SERVER_IP;databaseName=DB_NAME","USER_NAME","USER_PASSWORD")]]></parameterDescription>    </parameter>

 

Only one sub-report is using this MS_SQL_CONNECTION, all other sub-reports + the  main-report are using the "primary" connection (PostgreSQL).

Thanks

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