Étant donné que j'utilise une version plus récente de JRC, le remplacement des informations de connexion à la base de données ne fonctionne plus. Je ne sais pas pourquoi. Ce code a travaillé avec une version JRC de l'automne dernier (malheureusement je n'ai pas de numéro de version):Remplacer une connexion de base de données pour les sous-rapports avec JRC
ReportClientDocument doc = new ReportClientDocument();
doc.open("report.rpt");
IDatabase db = null; // get sub report database
// we'll overwrite the database connection information within
// the chosen report.
Map<String, String> bag = new HashMap<String, String>();
bag.put("Connection URL", "jdbc:oracle:thin:@LOCALHOST:1521:DATABASENAME");
bag.put("Server Type", "JDBC (JNDI)");
bag.put("Database DLL", "crdb_jdbc.dll");
bag.put("Database Class Name", "oracle.jdbc.driver.OracleDriver");
for (Object table : db.getTables()) {
updateTable(dhb, dc, (ITable)table, bag);
}
...
private void updateTable(DatabaseController dc, ITable table,
Map<String, String> bag) throws ReportSDKException {
ITable t = (ITable)table.clone(true);
LOGGER.debug(t.getName());
LOGGER.debug("1: " + t.getConnectionInfo().getAttributes());
IConnectionInfo connInfo = t.getConnectionInfo();
connInfo.setUserName("UserX");
connInfo.setPassword("xxxxx");
connInfo.setAttributes(new PropertyBag(bag));
// LOGGER.debug("ConnInfo Kind: " + connInfo.getKind());
t.setConnectionInfo(connInfo);
// t.setName(((ITable)table).getName());
t.setQualifiedName("UserX" + "." + table.getName());
dc.setTableLocation(table, t);
LOGGER.debug("2: " + t.getConnectionInfo().getAttributes());
}
Je reçois cette erreur: « Fehler bei der Suche nach JNDI-Namen (UtilisateurY) '. Cela signifie que JRC ne peut pas trouver le nom JNDI donné.
Est-ce que quelqu'un connaît des changements entre ces versions du JRC? Et quelqu'un connaît une solution?