The usage of a JNDI report source is very similar to using JDBC sources, the main difference is you don't need to stablish the driverClassName attribute.
The attributes required to be used with this type of data soruce are reflected in the following table:
|value||false||JNDI name of the data source|
|query||true||Query to be used to offer the data to the report|
This usage of the report source will give to the report a java.sql.Connection instance. The report must be desgined with a default query.
The most simple usage consist on stablish the two required attributes:
<jr:source id="jndiSource" value="jdbc/databasename" type="jndi" />
This kind of usage will give to the report a JasperReports' ResultSetDataSource instance. The report doesn't need to be designed with a default query.
To use queries with this kind of source you must include the query attribute:
<jr:source id="jndiSource" type="jndi" value="jdbc/databasename" query="select * from orders" />
Also you can use parametriced queries this way:
<jr:source id="jndiSource" type="jndi" value="jdbc/databasename" query="select * from orders where orderId = ?" > <f:param value="23938" /> </jr:source>