Hi there,

I have some materialized views in an oracle database. Due to the complexity of the query used to create the views I can not get the views to refresh on commit. I add information to the tables that the view is created from every half an hour using a quartz job. To refresh the view I wanted to run the following script from within java after the quartz job has run

EXECUTE DBMS_MVIEW.REFRESH('AWS_VIEW_LAST48_CAPEBG')

I tried to run it as I normally would run sql using the following code where REFRESH_ALL_VIEWS is a string containing the above script


Connection con = pool.getConnection();
PreparedStatement refresh = null;
try {

refresh = con.prepareStatement(REFRESH_ALL_VIEWS);
refresh.executeQuery();

} catch (java.sql.SQLException e) {
throw new RuntimeException(e);
} finally……..


However I get the following error :

java.sql.SQLException: ORA-00900: invalid SQL statement

I understand that it is not a valid sql statement and this is why I am getting the error.

Could anyone please tell me how I can run the script using java

Thanks,

Alex