Defect #498
Subreport connection-expression fails
0%
Description
I'm using a Main report with a Subreport. This Subreport shows data from another database so I've passed a java expression as connection-expression:
<connectionExpression><![CDATA[java.sql.DriverManager.getConnection("jdbc:postgresql://localhost:5532/myOtherDB", "DBA", "")]]></connectionExpression>
Into iReport it works fine but it doesn't into servoy smart client.
I've tried also to replace the jasper library with the new one version 4.5.1 but the behavior remains the same.
History
Updated by Andrei Costache about 12 years ago
- Assignee set to Andrei Costache
Corresponding Servoy forum thread: https://www.servoy.com/forum/viewtopic.php?f=15&t=18029.
Updated by Andrei Costache over 10 years ago
- Status changed from New to In Progress
Hi Marco,
Is this problem still present, or have you got around it or upgraded to a different setup?
If it still occurs, please let us know.
Best regards,
Andrei
Updated by Andrei Costache over 10 years ago
Hi,
Any updates regarding this issue?
Reading this description and the forum post, I am not sure I understand: does this work in the Developer started smart client or only in the Application Server smart client? Better, in which situation is this a problem, in both?
Have you tried with the standard versions, latest, of the plugin (3.3.x and 4.x/head?
Thank you.
Best regards,
Andrei
Updated by Andrei Costache about 10 years ago
Hi,
Not sure if this is still applicable, but posting a possible solution - this implies changes to the report itself to reference a different datasource and also adding the necessary jdbc driver to the classpath of the application (of Developer):
- in the report itself, create a parameter (for example here, we'll call it connectionParam), that is of class type java.sql.Connection
and that has a default value of java.sql.DriverManager.getConnection("jdbc:postgresql://localhost:5532/myOtherDB", "DBA", "")
. Then inside the subreport connection expression reference this report parameter: <connectionExpression><![CDATA[$P{connectionParam}]]></connectionExpression>
- make sure the jdbc driver is in the classpath of the client as well (so if you are using a debug smart client make sure the driver jar is in the servoy_jasperreports plugin folder)
This should make this scenario work.
Hope it helps,
Andrei