public synchronized int fileExists(JDBCSequentialFile file) throws SQLException {
  connection.setAutoCommit(false);
  selectFileByFileName.setString(1,file.getFileName());
  try (ResultSet rs=selectFileByFileName.executeQuery()){
    int id=rs.next() ? rs.getInt(1) : -1;
    connection.commit();
    return id;
  }
 catch (  Exception e) {
    connection.rollback();
    throw e;
  }
}

public synchronized int fileExists ( JDBCSequentialFile file ) throws SQLException { connection . setAutoCommit ( false ) ; selectFileByFileName . setString ( 1 , file . getFileName ( ) ) ; try ( ResultSet rs = selectFileByFileName . executeQuery ( ) ) { int id = rs . next ( ) ? rs . getInt ( 1 ) : - 1 ; connection . commit ( ) ; return id ; } catch ( Exception e ) { connection . rollback ( ) ; throw e ; } }
checks to see if a file with filename and extension exists . if so returns the id of the file or returns - 1 .
