Jump to content
We've recently updated our Privacy Statement, available here ×

Refreshing Oracle Materialized View before executing Jasper Report


aaronred

Recommended Posts

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

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...