Hi all,
I’ve a report that has a subreport inside. This subreport has to point to another database so, into iReport, I’ve specified this as subreport connection expression:
“java.sql.DriverManager.getConnection(“jdbc:postgresql://localhost:5532/businessdb”, “DBA”, “”)”
If I run it in iReport it works fine, if I run it into servoy developer I obtain the follows:
Error evaluating expression :
Source text : java.sql.DriverManager.getConnection("jdbc:postgresql://localhost:5532/businessdb", "DBA", "")
Wrapped java.lang.Exception: Error evaluating expression :
Source text : java.sql.DriverManager.getConnection("jdbc:postgresql://localhost:5532/businessdb", "DBA", "") (C:\Servoy_workspaces\Servoy5x_ws_deploy_and_demo\testJasper\forms\main.js#30)
at C:\Servoy_workspaces\Servoy5x_ws_deploy_and_demo\testJasper\forms\main.js:30 (onActionOpenReport)
P.s. To make this connection expression to work properly, I have specified to iReport to compile the report with java language.
If I compile it into an another language the expression fails. If this is the problem: Can someone give me an equivalent working expression? (Also in groovy if it works fine).
Thanks in advance
Marco
Why not pass a foundset through?
I’m running a report that has to gather data from 2 different db’s, I create a foundset using a sql statement and I pass the foundset as a param to the subreport. It works for me, the only difficulty I had was to get the query working on Postgres. I had to use dblink for this, because Postgres doesnot allow queries to run on multiple databases.
Thanks for the answer Jos,
Why not pass a foundset through?
Because between the Main and the Subreport there’s a 1-n relation.
For example:
I have an to display into the Main Report an internet site list with 10 occurrences; for each site into the Main report I have to display: Site-name, site-ip, site-creation-date etc…
Into this Main report there’s a Subreport that will contain the last 10 users-ip that have visited the site: Accept the “site_id” as parameter an make a query to retrive the data.
If the connection was the same, I could use as connection expression:
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
I never tried this, but can’t you use a different db connection in the subreport and don’t pass a connection from the main to the sub report? Or is that what you are already trying to do?
Actually I’m trying to pass a connection throught servoy plugins for the Main report and I’ve specified a connection-expression to use a different connection for the subreport
then i’m afraid i dont know how to help you.