• Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem with logon database in Crystal Report Viwer  RSS feed

 
arada theera
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to launch from jsp page.So I create test.rpt ( with one DB Logon)to test my sourcecode
:

com.crystaldecisions.sdk.occa.report.data.ConnectionInfos connInfos = null;
connInfos=new com.crystaldecisions.sdk.occa.report.data.ConnectionInfos();
com.crystaldecisions.sdk.occa.report.data.ConnectionInfo connInfo1 = null;
connInfo1=new com.crystaldecisions.sdk.occa.report.data.ConnectionInfo();

com.crystaldecisions.sdk.occa.report.data.ConnectionInfo connInfo2= null;
connInfo2=new com.crystaldecisions.sdk.occa.report.data.ConnectionInfo();

String tmpPath = "C:\\Program Files\\Crystal Decisions\\Crystal Reports 9\\Templates";
String rptPath = "C:\\Program Files\\Crystal Decisions\\Report Application Server 9\\Reports";

System.setProperty("ras.config", "C:\\Program Files\\Common Files\\Crystal Decisions\\2.0\\jars");

ReportClientDocument cd2 = new ReportClientDocument();
cd2.open(rptPath + "\\test.rpt", 0);

connInfo1.setUserName("testuser");
connInfo1.setPassword("testuser");

connInfos.add(connInfo1);

com.crystaldecisions.report.web.viewer.CrystalReportViewer tc1 = null;
tc1 = new com.crystaldecisions.report.web.viewer.CrystalReportViewer() ;
tc1.setReportSource(cd2.getReportSource());

tc1.setDatabaseLogonInfos(connInfos);
tc1.setEnableLogonPrompt(false);

tc1.setOwnForm(false);
tc1.setOwnPage(true);
tc1.setHasPrintButton(true);
tc1.refresh();
tc1.processHttpRequest(request, response, getServletConfig().getServletContext(),pageContext.getOut());

tc1.dispose();
cd2.close();


This sourcecode can work without any error.And then I edit my report ,I add one subreport in test.rpt ( subreport need one DB Logon ) .So I edit my sourcecode to I add these code :

connInfo2.setUserName("adminuser");
connInfo2.setPassword("adminuser");

connInfos.add(connInfo2);

When I run these code I get error :


com.crystaldecisions.report.web.viewer.CrystalReportViewer Logon failed.
Details: 28000:[Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user '(null)'.
Reason: Not associated with a trusted SQL Server connection.

Error in File C:\WINDOWS\TEMP\{5C0BA625-137F-449E-A419-BA6F6A4CF123}.rpt
: Unable to connect: incorrect log on parameters.

Anybody has any suggestion ?
I don't know what I do with these error ?
( May be logon subreport different from logon report ? I have no idea.)
Please Help.
 
Joel McNary
Bartender
Posts: 1840
Eclipse IDE Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I actually haven't used the Java API for Crystal (I get fed up with Crystal and switched to JasperReports...), but in the C API you had to explicitly set the connection info for subreports. (As in execute a call to get the list of subreports and then iteratively set the connection information for each subreport.)
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!