code: private void ensureSchemaVersion(Connection conn) throws DatabaseException {
          ResultSet rs = null;
          PreparedStatement ps = null;
          try {
              //TODO convert this to use DatabaseProperties
              ps = conn.prepareStatement("SELECT value FROM properties WHERE id = 'version'");
              rs = ps.executeQuery();
              if (rs.next()) {
                  final String dbSchemaVersion = settings.getString(Settings.KEYS.DB_VERSION);
                  final DependencyVersion appDbVersion = DependencyVersionUtil.parseVersion(dbSchemaVersion);
                  if (appDbVersion == null) {
                      throw new DatabaseException("Invalid application database schema");
                  }
                  final DependencyVersion db = DependencyVersionUtil.parseVersion(rs.getString(1));
                  if (db == null) {
                      throw new DatabaseException("Invalid database schema");
                  }
                  LOGGER.debug("DC Schema: {}", appDbVersion.toString());
                  LOGGER.debug("DB Schema: {}", db.toString());
                  if (appDbVersion.compareTo(db) > 0) {
                      updateSchema(conn, appDbVersion, db);
                      if (++callDepth < 10) {
                          ensureSchemaVersion(conn);
                      }
                  }
              } else {
                  throw new DatabaseException("Database schema is missing");
              }
          } catch (SQLException ex) {
              LOGGER.debug("", ex);
              throw new DatabaseException("Unable to check the database schema version", ex);
          } finally {
              DBUtils.closeResultSet(rs);
              DBUtils.closeStatement(ps);
          }
      }
docs: Uses the provided connection to check the specified schema version within
  the database.
  
  @param conn the database connection object
  @throws DatabaseException thrown if the schema version is not compatible
  with this version of dependency-check