for (Iterator i = databases.iterator(); i.hasNext();) { try { Database db = (Database) i.next(); if (!db.getDriver().equals("")) { Class driverClass = Thread.currentThread().getContextClassLoader(). loadClass( db.getDriver() ); DriverManager.registerDriver( (Driver) driverClass.newInstance() ); } JDBCReportListener listener = new JDBCReportListener( db.getUrl(), db.getUser(), db.getPassword(), db.getProjectId() ); report.addListener( listener ); } catch (Exception ex) { throw new BuildException( ex ); } }