aaronred Posted June 8, 2017 Share Posted June 8, 2017 I've created a Jasper Report which uses a materialized view. I want to refresh the mv every time before the report is executing to have updated data.Is there any way to do sth like thisin Jasper?Thanks for help guys! Link to comment Share on other sites More sharing options...
aaronred Posted June 9, 2017 Author Share Posted June 9, 2017 I tried this, but didn't work somehow:II've created a scriptlet with this code:@Override public void beforeReportInit() throws JRScriptletException { try { CallableStatement stmt = preparePlSqlCall( "DBMS_MVIEW.REFRESH('MV_CHECK_GRAFIK_KUNDEN','C')"); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } private Connection conn; private Connection getConnection() throws JRScriptletException { if (conn == null) { if (getParameterValue(JRFillParameter.REPORT_CONNECTION) != null) { conn = (Connection) (getParameterValue(JRFillParameter.REPORT_CONNECTION)); } else { throw new RuntimeException("Keine Datenbank-Verbindung am Report konfiguriert"); } } return conn; } protected CallableStatement preparePlSqlCall(String sql) throws JRScriptletException, SQLException { return getConnection().prepareCall("begin " + sql + "; end;"); }[/code]Does anynone see the mistake? I can execute the Report, but the materialized view doesn't refresh, not before nor after Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now