Does anyone know how to get triggers created over JDBC. It seems like the problem is with a semicolon. Any feedback is greatly appreciated.
The following SQL works when run in the database, but not when run using the following Java code:
Connection c=null; Statement s=null; try { c=dataSource.getConnection(); s=c.createStatement(); s.executeUpdate("create or replace trigger startuptrigger after insert on startuptest for each row begin insert into startuptest values(99); end"); s.close(); s=null; c.close(); c=null; } catch(SQLException e) { if(s!=null) { try { s.close(); } catch(Exception f){} } if(c!=null) { try { c.close(); } catch(Exception f){} } throw new IOException(e.toString()); }
I tried s.execute (...) and s.executeUpdate (...), and that doesn't make any difference. I am using the ojdbc5.jar driver. Oracle returns an error:
ORA-04098: trigger 'POLICYUAT.STARTUPTRIGGER' is invalid and failed re-validation
java oracle jdbc
corydoras
source share