BIRT report can be generated using hard coded Jdbc connections. But I had to generate 20+ reports. But jdbc url and credentials has to be changed in all reports when it's moved to production server which bit cumbersome.
Hence I thought to keep everything in one single place using JNDI data source option. If JNDI data source is created, then container such as Tomcat can manage connection pool etc. I did following steps in order to do that, but it always returning error as "jdbc url is null".
- Created JNDI data source in bonita.xml
<Resource name="ds/businessdb" auth="Container" type="javax.sql.DataSource" maxActive="5" maxIdle="-1" maxWait="10000" username="root" password="password" driverClassName="com.mysql.cj.jdbc.Driver" url="jdbc:mysql://<ip>:3306/db"/>
Added entry in birt web application's web.xml
<resource-ref> <description>Resource reference to a factory forjava.sql.Connection</description> <res-ref-name>ds/businessdb</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> </resource-ref>Then in the BIRT report design I used the JNDI url as
java:comp/env/ds/businessdb
It returns as jdbc url is null.