Java Reference
In-Depth Information
+ "and ae.aircraft_engine_code = a.aircraft_engine_code";
Class.forName("com.mysql.jdbc.Driver");
connection = DriverManager.getConnection ("jdbc:mysql://
localhost:3306/flightstats?user=user&password=secret");
statement = connection.createStatement();
resultSet = statement.executeQuery(query);
JRResultSetDataSource resultSetDataSource = new
JRResultSetDataSource(resultSet);
System.out.println("Filling report...");
JasperFillManager.fillReportToFile("reports/DbReportDS.jasper",
new HashMap(), resultSetDataSource);
System.out.println("Done!");
resultSet.close();
statement.close();
connection.close();
}
catch (JRException e)
{
e.printStackTrace();
}
catch (ClassNotFoundException e)
{
e.printStackTrace();
}
catch (SQLException e)
{
e.printStackTrace();
}
}
public static void main(String[] args)
{
new DbReportDSFill().generateReport();
}
}
 
Search WWH ::




Custom Search