private void initChunkMap ( ) { Statement stmt = null ; Connection connection = null ; try { Class . forName ( "org.sqlite.JDBC" ) ; connection = DriverManager . getConnection ( "jdbc:sqlite:" + databasePath ) ; // retrieve chunk IDs from database String sql = "SELECT id, chromosome, start FROM chunk" ; stmt = connection . createStatement ( ) ; ResultSet rs = stmt . executeQuery ( sql ) ; chunkIdMap = new HashMap <> ( ) ; while ( rs . next ( ) ) { chunkIdMap . put ( rs . getString ( "chromosome" ) + "_" + rs . getInt ( "start" ) , rs . getInt ( "id" ) ) ; } } catch ( SQLException e ) { logger . error ( e . getClass ( ) . getName ( ) + ": " + e . getMessage ( ) ) ; cleanConnectionClose ( connection , stmt ) ; } catch ( ClassNotFoundException e ) { logger . error ( e . getClass ( ) . getName ( ) + ": " + e . getMessage ( ) ) ; e . printStackTrace ( ) ; } }
Initialize the map of chunks .