Hi,
I'm unable to generate a report (using Crystal Reports XI) in a JSP page from a database that requires a login and a password. We've been trying several posibilities for the last two days without success, so if anyone with more experience could provide any comments, that'd be great (tech papers at businessobjects.com are certainly no help)
So far, this is the status:
1. We have a DSN database connection (fully tested - works without problems).
2. Using Crystal Reports XI, we've created a simple report for it (works OK)
3. Using a JSP page, we can generate the report
if we don't use a password for the database. This works ok.
4. If we DO USE a password in the database (i.e. we set it in the same database), we always get a "Logon failed" message.
Considerations:
1. The user name and password are correct.
2. If we open the report with Crystal using the same database and the same user / password, it works without problems.
I've pasted below the minimal source code we use to test this. Any help / comment here would be really welcome. Crystal doesn't provide any meaningful output or debug info, just a "Logon failed" jsp page.
Best regards,
- Juan
Complete JSP test code:
CrystalReportViewer crv = new CrystalReportViewer();
try {
ReportClientDocument reportClientDoc = new ReportClientDocument();
reportClientDoc.open("test.rpt", 0);
Object reportSource = reportClientDoc.getReportSource();
crv.setReportSource(reportSource);
crv.setEnableLogonPrompt(false);
ConnectionInfos connInfos = new ConnectionInfos();
IConnectionInfo connInfo1 = new ConnectionInfo();
connInfo1.setUserName("USER"); // We use the right user
connInfo1.setPassword("PASSWORD"); // And the right password
connInfos.add(connInfo1);
crv.setEnableLogonPrompt(false);
crv.setDatabaseLogonInfos(connInfos);
crv.refresh();
crv.setOwnPage(true);
crv.processHttpRequest(request, response, application, null);
} catch (Exception e) {
e.printStackTrace();
}
And the following entry in the web.xml ("estrella" is the test database)
<env-entry>
<env-entry-name>jdbc/estrella</env-entry-name>
<env-entry-value>!sun.jdbc.odbc.JdbcOdbcDriver!jdbc:odbc:estrella</env-entry-value>
<env-entry-type>java.lang.String</env-entry-type>
</env-entry>