i-net Clear Reports

Set the report data

The report engine i-net Clear Reports supports different data access methods for the report data. You need to set the datasource parameter if you do not want to use the data source configuration saved in the rpt file.

In the following sections we describe the different methods to access the data, their advantages and disadvantages and we show how to write your own class to fetch the data.

JDBC driver

This is the default concept. With the parameter datasource you can specify the data source configuration used for data access.

advantages:

  • No programming needed
  • The configuration is very fast

disadvantages:

  • you need a JDBC driver for your database
  • you can only use data from databases

The method setData() direct

With this method you can set the data of the main report directly. You can use setData with a ResultSet or setData with an array of objects.

advantages:

  • Can be used without JDBC

disadvantages:

  • This will not work with a sub-report.
  • You need access to the Engine object before it executes. This can be accomplished with the methods of the PropertiesChecker or by implementing your own Engine management.

You write your own Database class

You extend a class from the class Database and override the methods getReportData and useJdbcDriver. In the method getReportData you need to verify the context of the current engine. You can use the getXXX methods of the engine to verify the context. With the method getUserProperties() of the Engine you can verify all parameters in the report URL. For example you can use a session ID of your application in the report URL. If you have evaluated the context and find the needed data then you can use setData with a ResultSet or setData with an array of objects to set the data in the Engine.

advantages:

  • You can use data without JDBC.
  • This works with sub-reports as well.

disadvantages:

  • You need a complex logic because it is a callback technique.

Write a Dummy JDBC driver

You can write a simple JDBC driver that returns your data. This driver only needs to implement a small part of a JDBC driver. At least the following methods are needed:

  • Driver.connect(…)
  • Driver.getMajorVersion()
  • Driver.getMinorVersion()
  • Connection.getCatalog()
  • Connection.getMetaData()
  • Connection.setCatalog(String)
  • DatabaseMetaData.getDatabaseMajorVersion()
  • DatabaseMetaData.getDatabaseMinorVersion()
  • DatabaseMetaData.getDatabaseProductName() → need to return a name that is not matching a known database name, e.g. “MyOwnDatabase”
  • DatabaseMetaData.getDatabaseProductVersion()
  • DatabaseMetaData.getDriverName()
  • DatabaseMetaData.getDriverVersion()
  • DatabaseMetaData.getIdentifierQuoteString()
  • DatabaseMetaData.getProcedureColumns()
  • DatabaseMetaData.getTables()
  • ResultSet.getMetaData()
  • ResultSet.getObject()
  • ResultSet.next()

If you simulate tables:

  • Connection.createStatement()
  • Statement.executeQuery()

If you simulate stored procedures with parameters

  • DatabaseMetaData.getProcedures()
  • DatabaseMetaData.getProcedureColumns()
  • Connection.prepareStatement()
  • PreparedStatement.setXXX methods
  • PreparedStatement.executeQuery()

Please note: This list is subject to change without notice due to further development of i-net Clear Reports.


i-net software strives to provide accurate product documentation. Please give us your feedback using the form below.
NOTE: This form is for documentation feedback only. For technical assistance, please send an email to clearreports@inetsoftware.de.

 

© Copyright 1996 - 2012, i-net software; All Rights Reserved.