on 01-28-2009 3:02 PM
Hi.
Our reporting component used JRC 1.x before we upgraded to JRC 2.x. We got two issues after upgrading.
First issue I solved already with a workaround which I published on stackoverflow.com. (1) Does anyone knows where I will find the issue management system to report this issue?
Second issue occurs big performance problem within our project. We opened a report with 6 subreports (which includes 1 upto 3 tables) in 2-4 seconds using JRC 1. If we will open same report using JRC 2, we wait upto 60 seconds.
This methods requires more time with JRC 2 comparing to JRC 1:
ReportClientDocument#open(String, int);
SubreportController#setTableLocation(String, ITable, ITable)
DatabaseController#setTableLocation(ITable, ITable)
Each invocation of one of these methods requires 2-4 seconds.
Thank you in advance.
Best regards
Thomas
(1) http://stackoverflow.com/questions/479405/replace-a-database-connection-for-subreports-with-jrc
Hi Ted Ueda
Thank you for your response.
It was me who posted the message above, now with an own profile.
I've already tested
replaceConnection(...)
This variant does not work because it didn't replace all connection information in subreports. I don't know why. I'm going to post my code below. Apart from it requires unfortunately also 50-60 seconds until I'll get an exception.
Best regards,
Thomas
DatabaseController dc = doc.getDatabaseController();
ConnectionInfos cis = dc.getConnectionInfos(null);
for (IConnectionInfo oldci : cis) {
IConnectionInfo newci = new ConnectionInfo();
newci.setAttributes(new PropertyBag(bag));
newci.setUserName("xxx");
newci.setPassword("xxx");
dc.replaceConnection(oldci, newci, null, DBOptions._useDefault);
}
SubreportController src = doc.getSubreportController();
IStrings strs = src.getSubreportNames();
Iterator<?> it = strs.iterator();
while (it.hasNext()) {
String name = (String)it.next();
ISubreportClientDocument subreport = src.getSubreport(name);
DatabaseController sdc = subreport.getDatabaseController();
cis = sdc.getConnectionInfos(null);
for (IConnectionInfo oldci : cis) {
IConnectionInfo newci = new ConnectionInfo();
newci.setAttributes(new PropertyBag(bag));
newci.setUserName("xxx");
newci.setPassword("xxx");
sdc.replaceConnection(oldci, newci, null, DBOptions._useDefault);
}
}
For our code without replaceConnection(...) see
Edited by: Thomas Zuberbuehler on Jan 28, 2009 6:09 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It requires around 10 seconds if I use
sdc.replaceConnection(oldci, newci, null, DBOptions._useDefault + DBOptions._doNotVerifyDB);
But I get
2009-01-28 18:25:25,702 ERROR JRCCommunicationAdapter - detected an exception:
Unerwarteter Datenbank-Connector-Fehler
at com.crystaldecisions.reports.datafoundation.DFQuery.for(Unknown Source)
Independent which report I'm going to use. Each of this reports worked before even with JRC 2 and setTableLocation(...).
Thank you in advance.
Best regards,
Thomas
PS. Unerwarteter Datenbank-Connector-Fehler = Unexpected database connector error
Interesting - that suggests connectivity issues as I referenced earlier.
The "do not verify database" option is something I recommend when using replaceConnection, when setTableLocation(..,..) appears to try connecting to the old or wrong database connection. Then after the replaceConnection call, do explicit verifyDatabase, or try running the report.
After you make the replaceConnection(...), what happens if you save the report (reportClientDocument.saveAs("report_name.rpt", "C:
", ReportSaveAsOptions._overwriteExisting)), then open in the designer and have a look at the connection info? Do any look "bad" to you?
Sincerely,
Ted Ueda
Hi Ted Ueda
It works!
// bag is a Map<String, String> and contains connection information
// doc is an existing instance of ReportClientDocument
prepareReport(doc, bag);
changeDataSource(doc, bag);
private void changeDataSource(ReportClientDocument doc, Map<String, String> bag)
throws ReportSDKException {
DatabaseController dc = doc.getDatabaseController();
ConnectionInfos cis = dc.getConnectionInfos(null);
for (IConnectionInfo oldci : cis) {
IConnectionInfo newci = new ConnectionInfo();
newci.setAttributes(new PropertyBag(bag));
newci.setUserName("xxxx");
newci.setPassword("xxxx");
dc.replaceConnection(
oldci, newci, null, DBOptions._useDefault + DBOptions._doNotVerifyDB);
}
SubreportController src = doc.getSubreportController();
IStrings strs = src.getSubreportNames();
Iterator<?> it = strs.iterator();
while (it.hasNext()) {
String name = (String)it.next();
ISubreportClientDocument subreport = src.getSubreport(name);
DatabaseController sdc = subreport.getDatabaseController();
cis = sdc.getConnectionInfos(null);
for (IConnectionInfo oldci : cis) {
IConnectionInfo newci = new ConnectionInfo();
newci.setAttributes(new PropertyBag(bag));
newci.setUserName("xxxx");
newci.setPassword("xxxx");
sdc.replaceConnection(
oldci, newci, null, DBOptions._useDefault + DBOptions._doNotVerifyDB);
}
}
}
private void prepareReport(ReportClientDocument doc, Map<String, String> bag)
throws ReportSDKException {
DatabaseController dc = doc.getDatabaseController();
IDatabase db = dc.getDatabase();
for (Object table : db.getTables()) {
((ITable)table).setQualifiedName("userNameX".toUpperCase()
+ "." + ((ITable)table).getName());
}
}
Same we should do for the subreports.
Thank you for your advice!!
Edited by: Thomas Zuberbuehler on Jan 28, 2009 7:30 PM
Thank you for your help.
Yes, the performance problem is solved.
It seems that the method replaceConnection(...) using DBOptions._doNotVerifyDB and replacing the qualified name for each table solves the performance and database connector problem.
Independent to this solution. May there is already a possibility to disable the verify function within DatabaseController#setTableLocation(ITable, ITable)? If not it would be an idea to add this flexibility?
There's no way to disable the verify database for Crystal Reports for Eclipse setTableLocation that I'm aware of.
The workflow you're using is the recommended one - wholescale change connection w/o db verify using replace connection, then change any per-table properties using setTableLocation.
I'm happy that it's working out for you - your post is going to help a lot of CR4E users out there.
I was going to Blog on the replaceConnection method, but other things took up my time...
Sincerely,
Ted Ueda
Hi,
my Problem is that the
dc.replaceConnection(oldci, newci, null, DBOptions._useDefault
+ DBOptions._doNotVerifyDB);
doesn't work in all my reports which define Sub-Reports in it.
I opened the modified rpt file in the cr4e designer too and the connections seams to be ok. But if I will run preview in the designer i get also:
Unerwarteter Datenbank-Connector-Fehler with no Stacktrace etc.
Any Ideas?
hello all....
my report is ''crystal report 11'' => "OLE DB" => "Add Command(select * from table) " .
code(JRC) : eclipse + crystal report for eclipse version 2 => "cr4e-all-in-one-win_2.0.1.zip"
<%@ page contentType="text/html; charset=UTF-8"
import="
com.crystaldecisions.report.web.viewer.CrystalReportViewer,
com.crystaldecisions.reports.sdk.ReportClientDocument,
com.crystaldecisions.sdk.occa.report.lib.ReportSDKExceptionBase,
java.sql.Connection,
java.sql.DriverManager,
java.sql.ResultSet,
java.sql.SQLException,
java.sql.Statement" %>
<%
try {
String reportName = "report.rpt";
ReportClientDocument clientDoc = new ReportClientDocument();
clientDoc.open(reportName, 0);
String tableAlias = "Command";
clientDoc.getDatabaseController().setDataSource(myResult("SELECT * FROM table"), tableAlias,tableAlias);
CrystalReportViewer crystalReportPageViewer = new CrystalReportViewer();
crystalReportPageViewer.setReportSource(clientDoc.getReportSource());
crystalReportPageViewer.processHttpRequest(request, response, application, null);
} catch (ReportSDKExceptionBase e) {
e.printStackTrace();
out.println(e);
}
%>
I simplified the code, *myResult("SELECT * FROM table") * is absolutely no problem ,
and this code is absolutely no problem in the "crystal report for eclipse "version 1
but in version 2 run error:
Please help me and tell me why....
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hello ....
my report is ''crystal report 11'' => "OLE DB" => "Add Command(select * from table) " .
code(JRC) : eclipse + crystal report for eclipse version 2 => "cr4e-all-in-one-win_2.0.1.zip"
<%@ page contentType="text/html; charset=UTF-8"
import="
com.crystaldecisions.report.web.viewer.CrystalReportViewer,
com.crystaldecisions.reports.sdk.ReportClientDocument,
com.crystaldecisions.sdk.occa.report.lib.ReportSDKExceptionBase,
java.sql.Connection,
java.sql.DriverManager,
java.sql.ResultSet,
java.sql.SQLException,
java.sql.Statement" %>
<%
try {
String reportName = "report.rpt";
ReportClientDocument clientDoc = new ReportClientDocument();
clientDoc.open(reportName, 0);
String tableAlias = "Command";
clientDoc.getDatabaseController().setDataSource(myResult("SELECT * FROM table"), tableAlias,tableAlias);
CrystalReportViewer crystalReportPageViewer = new CrystalReportViewer();
crystalReportPageViewer.setReportSource(clientDoc.getReportSource());
crystalReportPageViewer.processHttpRequest(request, response, application, null);
} catch (ReportSDKExceptionBase e) {
e.printStackTrace();
out.println(e);
}
%>
I simplified the code, *myResult("SELECT * FROM table") * is absolutely no problem ,
and this code is absolutely no problem in the "crystal report for eclipse "version 1
but in version 2 run error:
com.crystaldecisions.sdk.occa.report.lib.ReportSDKException: u7121u6CD5u9810u671Fu7684u8CC7u6599u5EABu9023u7DDAu5668u932Fu8AA4---- Error code:-2147467259 Error code name:failed
at com.businessobjects.reports.sdk.JRCCommunicationAdapter.a(Unknown Source)
at com.businessobjects.reports.sdk.JRCCommunicationAdapter.a(Unknown Source)
at com.businessobjects.reports.sdk.JRCCommunicationAdapter.if(Unknown Source)
at com.businessobjects.reports.sdk.JRCCommunicationAdapter.a(Unknown Source)
at com.businessobjects.reports.sdk.JRCCommunicationAdapter$2.a(Unknown Source)
at com.businessobjects.reports.sdk.JRCCommunicationAdapter$2.call(Unknown Source)
at com.crystaldecisions.reports.common.ThreadGuard.syncExecute(Unknown Source)
at com.businessobjects.reports.sdk.JRCCommunicationAdapter.for(Unknown Source)
at com.businessobjects.reports.sdk.JRCCommunicationAdapter.int(Unknown Source)
at com.businessobjects.reports.sdk.JRCCommunicationAdapter.request(Unknown Source)
at com.businessobjects.sdk.erom.jrc.a.a(Unknown Source)
at com.businessobjects.sdk.erom.jrc.a.execute(Unknown Source)
at com.crystaldecisions.proxy.remoteagent.RemoteAgent$a.execute(Unknown Source)
at com.crystaldecisions.proxy.remoteagent.CommunicationChannel.a(Unknown Source)
at com.crystaldecisions.proxy.remoteagent.RemoteAgent.a(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.ReportClientDocument.if(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.ReportClientDocument.a(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.ReportClientDocument.new(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.b9.onDataSourceChanged(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.DatabaseController.a(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.DatabaseController.a(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.DatabaseController.setDataSource(Unknown Source)
at org.apache.jsp.No_005f1.Eclipse_005fJTDS_005fSQL2005_005fTable_002dviewer_jsp._jspService(Eclipse_005fJTDS_005fSQL2005_005fTable_002dviewer_jsp.java:106)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Unknown Source)
Caused by: com.crystaldecisions.reports.common.QueryEngineException: u7121u6CD5u9810u671Fu7684u8CC7u6599u5EABu9023u7DDAu5668u932Fu8AA4
at com.crystaldecisions.reports.queryengine.Connection.bf(Unknown Source)
at com.crystaldecisions.reports.queryengine.Rowset.z3(Unknown Source)
at com.crystaldecisions.reports.queryengine.Rowset.bL(Unknown Source)
at com.crystaldecisions.reports.queryengine.Rowset.zM(Unknown Source)
at com.crystaldecisions.reports.queryengine.Connection.a(Unknown Source)
at com.crystaldecisions.reports.queryengine.Table.a(Unknown Source)
at com.crystaldecisions.reports.queryengine.Table.if(Unknown Source)
at com.crystaldecisions.reports.queryengine.Table.try(Unknown Source)
at com.crystaldecisions.reports.queryengine.Table.a(Unknown Source)
at com.crystaldecisions.reports.queryengine.Table.u7(Unknown Source)
at com.crystaldecisions.reports.datafoundation.DataFoundation.a(Unknown Source)
at com.crystaldecisions.reports.dataengine.dfadapter.DFAdapter.a(Unknown Source)
at com.crystaldecisions.reports.dataengine.dfadapter.CheckDatabaseHelper.a(Unknown Source)
at com.crystaldecisions.reports.dataengine.datafoundation.CheckDatabaseCommand.new(Unknown Source)
at com.crystaldecisions.reports.common.CommandManager.a(Unknown Source)
at com.crystaldecisions.reports.common.Document.a(Unknown Source)
at com.crystaldecisions.reports.dataengine.VerifyDatabaseCommand.new(Unknown Source)
at com.crystaldecisions.reports.common.CommandManager.a(Unknown Source)
at com.crystaldecisions.reports.common.Document.a(Unknown Source)
at com.businessobjects.reports.sdk.requesthandler.f.a(Unknown Source)
at com.businessobjects.reports.sdk.requesthandler.DatabaseRequestHandler.a(Unknown Source)
at com.businessobjects.reports.sdk.requesthandler.DatabaseRequestHandler.if(Unknown Source)
at com.businessobjects.reports.sdk.JRCCommunicationAdapter.do(Unknown Source)
... 39 more
Please help me and tell me why....
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you find an issue with the CR4E Version 2 SDK, then please do post here.
As for the setTableLocation call, it's very touchy and at times can do a verify database call (try connecting to the database to ensure the schema hasn't changed) when you least want it.
Depending on the properties you're trying to change, what if you instead do a replaceConnection(...) method call to change over the connection info? Do you get better results? I generally do.
Sincerely,
Ted Ueda
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.