@Override
        public void close(TaskAttemptContext context) throws IOException {
          try {
            super.close(context);
          } finally {
            GenericJdbcDatabaseAccessor.this.close();
          }
        }
A data accessor that should in theory work with all JDBC compliant database drivers.
jdbc-handler/src/main/java/org/apache/hive/storage/jdbc/dao/GenericJdbcDatabaseAccessor.java