An illustrative example

In the following program, the Catalog Bean will be used to change the connection of a catalog:

try
{ 
// create catalog bean 
JRCatalog jrCatalog = new JRCatalog();
// set report home 
jrCatalog.setReportHome( "c:\\jrcbean"); 
// load catalog 
jrCatalog.setCatName("c:\\a.cat">);
loadCatalog(); 
// modify connection 
ConnectionDesc conDesc = new ConnectionDesc(); 
conDesc.strName = "Demo"; 
conDesc.strURL = "jdbc:oracle:thin:@myhost:1521:orcl"; 
conDesc.strUser = "System"; 
conDesc.strPassword = "Manager"; 
conDesc.strDriver = "oracle.jdbc.driver.OracleDriver"; 
jrCatalog.modifyConnection(conDesc);
// save catalog 
jrCatalog.saveCatalog(); 
// close catalog 
jrCatalog.closeCatalog(); 
}
catch(JRCatalogException e)
{ 
System.out.println(e); 
}