First, the prerequisite requirements Description:
Recently, when I was working on a project, I used JBoss wildfly to publish the Birt report, which I added directly to the JDBC data source to connect to the database through the databases URL, user name, and password. Later, when deploying to a formal and test server, you need to modify the data source of the report file every time. So I think there's a way. How to configure in the report file and the service system, when the deployment no longer need to repeatedly modify the data source. At this point I thought of Jndi (Java naming and directory Interface, Java naming and directory interface).
By default the database URL to connect to the configuration is very simple, just download SQL Server driver, and then add to Birt Drive management, you can choose to through the drop-down box driver Class, which is no longer described in detail. When the Birt report is connected to the database, the database is connected through the databases URL first, if the connection is not over the Jndi connection.
Second, WildFly configuration Jndi
The default address for the Wildfly service Management console is Http://127.0.0.1:9990/console, and after linking because there are no users, you will be prompted to add users through Add-user.bat. Just follow the prompts to create the user and then log in to the console with the user you created.
There is a problem here, when creating the data source, you need to select the JDBC driver deployed in the system, then you need to put the driver jar package of your SQL Server database under LIB under the Web project. Also note that your driver package must be in JDBC-4 format, otherwise you will not see the driver you want to select under "Detected Driver". There is the last step, fill in the connection URL when the default URL to a more than one Microsoft, remove (jdbc:microsoft:sqlserver--jdbc:sqlserver). Other local configuration is relatively simple, do not repeat it.
Iii. publication of the report
Finally, remember the configured Jndi name and fill it in the JDBC configuration in the Birt report data source. From there, you can deploy the report directly to the system, where you can remove the user name and password, and the system will connect to the database directly through Jndi.
Finally put a SQL Server database connection driver jar file: https://www.microsoft.com/zh-cn/download/confirmation.aspx?id=11774
WildFly 9.0.2 + SQL Server + BIRT + JNDI handles changes to data sources when BIRT report is published