Birt is integrated in the spring environment. It usually uses the same database configuration as the spring application. To keep the datasource of Birt identical with that of the Web application, make the following settings.
Birt datasources-script-beforeopen
Importpackage (packages.org. springframework. Context. Support); // reference the spring class
Importpackage (packages.org. Apache. commons. DBCP); // apply the datasource class
VaR CTX = new classpathxmlapplicationcontext ("applicationcontext. xml"); // read the spring configuration file
VaR datasource = CTX. getbean ("datasourcename"); // read datasource
Extensionproperties. odaurl = new string (datasource. geturl (); // read the URL and assign a value
Extensionproperties. odauser = new string (datasource. GetUserName (); // read username and assign values
Extensionproperties. odapassword = new string (datasource. GetPassword (); // read the password and assign a value
Report design first comment out these statements
Run these scripts in the running environment.