@Override
    public boolean isValidDataBase() {
        int version = getPoiFileInfo().version;
        try {
            if (version < 2) {
                this.isValidDBStatement = this.conn.prepareStatement(DbConstants.VALID_DB_STATEMENT_V1);
            } else {
                this.isValidDBStatement = this.conn.prepareStatement(DbConstants.VALID_DB_STATEMENT);
            }
        } catch (SQLException e) {
            LOGGER.log(Level.SEVERE, e.getMessage(), e);
        }

        // Check for table names
        // TODO Is it necessary to get the tables meta data as well?
        int numTables = 0;
        ResultSet rs = null;
        try {
            rs = this.isValidDBStatement.executeQuery();
            if (rs.next()) {
                numTables = rs.getInt(1);
            }
        } catch (SQLException e) {
            LOGGER.log(Level.SEVERE, e.getMessage(), e);
        } finally {
            try {
                if (rs != null) {
                    rs.close();
                }
            } catch (SQLException e) {
                LOGGER.log(Level.SEVERE, e.getMessage(), e);
            }
        }

        if (version < 2) {
            return numTables == DbConstants.NUMBER_OF_TABLES_V1;
        } else {
            return numTables == DbConstants.NUMBER_OF_TABLES;
        }
    }
@ Override public boolean isValidDataBase ( ) { int version = getPoiFileInfo ( ) . version ; try { if ( version < 2 ) { this . isValidDBStatement = this . conn . prepareStatement ( DbConstants . VALID_DB_STATEMENT_V1 ) ; } else { this . isValidDBStatement = this . conn . prepareStatement ( DbConstants . VALID_DB_STATEMENT ) ; } } catch ( SQLException e ) { LOGGER . log ( Level . SEVERE , e . getMessage ( ) , e ) ; } int numTables = 0 ; ResultSet rs = null ; try { rs = this . isValidDBStatement . executeQuery ( ) ; if ( rs . next ( ) ) { numTables = rs . getInt ( 1 ) ; } } catch ( SQLException e ) { LOGGER . log ( Level . SEVERE , e . getMessage ( ) , e ) ; } finally { try { if ( rs != null ) { rs . close ( ) ; } } catch ( SQLException e ) { LOGGER . log ( Level . SEVERE , e . getMessage ( ) , e ) ; } } if ( version < 2 ) { return numTables == DbConstants . NUMBER_OF_TABLES_V1 ; } else { return numTables == DbConstants . NUMBER_OF_TABLES ; } }
{@inheritDoc}