• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem with logon database in Crystal Report Viwer

 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Bartender
Posts: 1844
Eclipse IDE Ruby Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.)
 
I was born with webbed fish toes. This tiny ad is my only friend:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic