java - Replace a database connection for subreports with JRC -


Because I am using a new release of JRC, because the replacement of database connection information does not work any more . I do not know why this code worked with a JRC version last autumn (unfortunately I do not have a release number):

  ReportClientDocument doc = new ReportClientDocument (); Doc.open ("report.rpt"); Idbs db = zero; // Get the sub-database report // We will notify the database connection information // in the selected report. Maps & lt; String, string & gt; Bag = new hashmop & lt; String, string & gt; (); Bag.Put ("Connection URL", "JDBC: Oracle: Thin: @ Olackhost: 1521: DatabaseM"); Bag.put ("server type", "jdbc (jdci)"); Bag.put ("database dll", "crdb_jdbc.dll"); Bag.put ("database class name", "oracle.jdbc.driver.OracleDriver"); (Object table: db.getTables ()) for {updateTable (DHB, DC, Table Table, Table); }  

...

  Private Zune updateTable (database controller DC, ITable table, map & lt; string, string & gt; 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 ((table of tablets) .getName ()); T.setQualifiedName ("UserX" + "." + Table.getName ()); Dc.setTableLocation (Table, T); LOGGER.debug ("2:" + t.getConnectionInfo (). GetAttributes ()); }  

I get this error: 'Fehler b der suechach danc jndi-naman (user y)'. This means that the JNTI name given to JRC can not be found.

Does anyone know some change between those JRC releases? And does anyone know a solution?

"post-text" itemprop = "text">

I have found an alternative solution after the problem and a long debugging session.

// Incomplete code for example (object table: db.getTables ()) {ITB T = (ITABLE) ((ITABLE) table). Clone (true); Println (t.getName ()); // Modified T, is a current example of bag class PropertyBag t.getConnectionInfo (). SetAttributes (bag); // DC Database Controller is an existing example of dc.setTableLocation (table of tablets, tablets, Tables, T)}

db.getTables () B is and c. If we run the code above, then code <.> will print A, A, B to print.

If we are going to comment on dc, SetTableLocation (table of ITABLE), T) A, B, C will be printed I think that the dc.setTableLocation ((ITable) table, T) internally modifies the list of tables.

We are using the following solution:

  // Incomplete code example // Carcord code map & lt; Itables, Itebels & gt; OldNewMap = New Hashmop & lt; Itables, Itebels & gt; (); (Table for Object Table: db.getTables ()) {ITB T = (Itable) ((Itatable Table)) Clone (true); Println (t.getName ()); // Modified T, is a current example of bag class PropertyBag t.getConnectionInfo (). SetAttributes (bag); // Carcond Code Puranaiimempop ((ITATABLE) table, T); } // code code (entry and lieutenant; itable, itabel> e: puritanimap.netnet ()) {dc.setTableLocation (e.getKey (), e.gast value ()); }  

I hope that with this solution nobody will save time and money. ;-) I even posted it on the official forum.


Comments