java - Using try-with-resources statement with JDBC4.0 and previous -
directly this oracle tutorial:
in jdbc 4.1, available in java se release 7 , later, can use try-with-resources statement automatically close
does mean if use java 7 jdbc 4.0 or previous versions won't able use try-with-resources statement?
thanks in advance.
using try-with-resource in java 7 jdbc 4.0 (or earlier) driver work. application uses java.sql interfaces java 7, , these interfaces implement java.lang.autocloseable. jdbc 4.0 implementation have close() method conforms autocloseable contract (that has method close() , throws subclass of exception), work.
the fact wasn't compiled against 'version' of interface doesn't matter, runtime combination of interfaces , implementation decides works. result of linking of classes , binary compatibility defined in java language specification.
Comments
Post a Comment