Wednesday, 21 August 2013

NextReports Engine: Integration Demo Hints

After you download nextreports-integration-demo from NextReports Site, you can run some sample code to see how to use engine api.

To make it easily for every java developer, from version 6.2, you can define a DemoDefinition class for your database. You can see such class for a Firebird connection, where you define database name, report /chart name, map of parameters and  database connection:
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;

public class FirebirdDemoDefinition implements DemoDefinition {

public String getDatabaseName() {
return "Firebird Test";

public String getReportName() {
return "";

public Connection createDemoConnection() throws ClassNotFoundException, SQLException {
String url = "jdbc:firebirdsql:";
System.out.println("Connect to '" + url + "'");
return DriverManager.getConnection(url, "SYSDBA", "sysdba");

public Map<String, Object> createDemoParameterValues() {
Map<String, Object> parameterValues = new HashMap<String, Object>();
return parameterValues;

public String getChartName() {
return null;

You just have to add your definition to DemoDefinitionFactory class and inside DemoUtil class change your NextReports home and your definition:
public static final String NEXTREPORTS_HOME = "D:\\Programs\\NextReports 6.2";
public static DemoDefinition def = DemoDefinitionFactory.get(DemoDefinitionFactory.FIREBIRD_DB);
This will help to test faster your JDBC driver compliance with NextReports.

No comments:

Post a comment