No exceptions on violating queries via JDBC
The problem arises when I issue some violating query (e.g. FK constraint) with JDBC statements. Here’s an exmample: Connection con = dataSource.getConnection(); con.setAutoCommit(false); PreparedStatement stmnt = con.prepareStatement("/*Query with wrong FK*/"); stmnt.executeUpdate(); stmnt.close(); // exception is generated internally, but swallowed con.commit(); //no effect con.close(); As can be seen from the log messages, exception is not propagated outside of the driver library. Moreover, next calls to methods like commit have no effect at all. So, you cannot know if the statement executed successfully. Other drivers (like MySQL) throw exception on Statement.executeStatement() call even if autocommit is disabled. Due to this fact tools like Hibernate cannot work correctly. Can anyone comment on this?
Sign up
Already have an account? Login
Welcome to the Rocket Forum!
Please log in or register:
Employee Login | Registration Member Login | RegistrationEnter your E-mail address. We'll send you an e-mail with instructions to reset your password.

If I commit the transaction before closing the statement, I'll get an SQLException, which is an expected behaviour. 
