Specifying data source in ejb-jar.xml or web.xml (for the EAR mode)

When the JReport Enterprise Server is used with APIs by EJBs, you can specify the dsInfo either in the file ejb-jar.xml in /META-INF or web.xml in /WEB-INF.

For information about specifying a data source in the web.xml file, see section Specifying data source in web.xml (for the WAR mode).

Note: If the dsInfo is stored in a Web module, you should add the JReport Enterprise Server context listener to the WEB-INF/web.xml file. Here is an example:


<web-app> <listener> <listener-class> jet.server.servlets.JRServerContextListener </listnener-class> </listener> ... </web-app>

You can specify the dsInfo in the META-INF/ejb-jar.xml file using the <env-entry></env-entry> tags. For example, here is an EJB named firstEJB which creates the JReport Enterprise Server instance. You can add the <env-entry></env-entry> tags to the EJB's configuration file - META-INF/ejb-jar.xml as follows:

<ejb-jar>
<enterprise-beans>
<session> 
<ejb-name>firstEJB</ejb-name>
...
<env-entry>
<env-entry-name>jreport.datasource.systables</env-entry-name> 
<env-entry-value>jndi://resource_name</env-entry-value>
<env-entry-type>java.lang.String</env-entry-type> 
</env-entry>
</session> 
...

</enterprise-beans> 
...

</ejb-jar>