on 05-23-2007 4:27 PM
i am using crystal report xi and jsp and oracle. when i try to change the datsource location during runtime,i am getting an exception com.crystaldecisions.sdk.occa.report.lib.ReportSDKException: Logon Error: invalid arguments in call---- Error code:-2147467259 Error code name:failed
my code
String ipo=request.getParameter("pop");
String reportName = "/ireport.rpt";
try {
Object reportSource = session.getAttribute("reportSource");
ReportClientDocument reportClientDoc = new ReportClientDocument();
reportClientDoc.open(reportName, 0);
DatabaseController databaseController = reportClientDoc.getDatabaseController();
//Obtain collection of tables from this database controller.
Tables tables = databaseController.getDatabase().getTables();
//Set the datasource for all main report tables.
for (int i = 0; i < tables.size(); i++) {
ITable table = tables.getTable(i);
//Keep existing name and alias.
table.setName(table.getName());
table.setAlias(table.getAlias());
//Change properties that are different from the original datasource.
//Change connection information properties.
ConnectionInfos connInfos = new ConnectionInfos();
IConnectionInfo connInfo1 = table.getConnectionInfo();
final String DBUSERNAME = "porety";
final String DBPASSWORD = "******8";
final String SERVERNAME = "434.135.1.245";
final String CONNECTION_STRING = "Use JDBC=b(true);Connection URL=s(jdbc:oracle:thin:@434.135.1.245:1521:lol);" +
"Database Class Name=s(oracle.jdbc.driver.OracleDriver);Server=s(434.135.1.245);" +
"User ID=s(porety);Password=;Database=s(ORCL);Trusted_Connection=b(false);" +
"JDBC Connection String=s(!oracle.jdbc.driver.OracleDriver!jdbc:oracle:thin:@434.135.1.245:1521:lol;" +
"DatabaseName={database};user=;password=!)"; final String DATABASE_NAME = "lol"; final String URI = "!oracle.jdbc.driver.OracleDriver!jdbc:oracle:thin:@434.135.1.245;DatabaseName=;user=;password=!";
//final String DATABASE_DLL = "crdb_jdbc.dll";
// get dll name first so we do not use different dll
PropertyBag existingPropertyBag = connInfo1.getAttributes();
String dllRequired = existingPropertyBag.getStringValue("Database DLL");
PropertyBag propertyBag = new PropertyBag();
//Overwrite any existing properties with updated values.
propertyBag.put("Trusted_Connection", "false");
propertyBag.put("Server Name", SERVERNAME); //Optional property.
//propertyBag.put("Connection String", CONNECTION_STRING);
propertyBag.put("Database Name", DATABASE_NAME);
propertyBag.put("Server Type", "JDBC (JNDI)");
propertyBag.put("URI", URI);
propertyBag.put("Use JDBC", "true");
propertyBag.put("Database DLL", dllRequired);
connInfo1.setUserName(DBUSERNAME);
connInfo1.setPassword(DBPASSWORD);
connInfo1.setKind(ConnectionInfoKind.SQL);
connInfo1.setAttributes(propertyBag);
connInfos.add(connInfo1);
table.setConnectionInfo(connInfo1);
//Update old table in the report with the new table.
databaseController.setTableLocation(table, tables.getTable(i));
Fields fields=new Fields();
ParameterField paramfield=new ParameterField();
Values vals=new Values();
ParameterFieldDiscreteValue val=new ParameterFieldDiscreteValue();
paramfield.setName("pop");
val.setValue(pop);
vals.add(val);
paramfield.setCurrentValues(vals);
fields.add(paramfield);
CrystalReportViewer viewer=new CrystalReportViewer();
viewer.refresh();
viewer.setDatabaseLogonInfos(connInfos);
viewer.setReportSource(reportSource);
viewer.setParameterFields(fields);
viewer.setReuseParameterValuesOnRefresh(true);
viewer.setHasPageBottomToolbar(false);
viewer.setHasLogo(false);
viewer.setOwnPage(true);
viewer.setOwnForm(true);
viewer.processHttpRequest(request, response, getServletConfig().getServletContext(), null);
viewer.dispose();
}
} catch(Exception e) {
out.print(e);
}
please any one help me.very urgent
regards
siva
Please re-post if this is still an issue to the .NET Development - Crystal Reports Forum or purchase a case and have a dedicated support engineer work with you directly
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
92 | |
11 | |
10 | |
9 | |
9 | |
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.