question: @ Override public void execute ( Database database ) throws CustomChangeException { PreparedStatement products = null ; ResultSet products_res = null ; JdbcConnection db_connection = ( JdbcConnection ) database . getConnection ( ) ; try { products = db_connection . prepareStatement ( "SELECT PRODUCT.ID ID," + "       PRODUCT.DOWNLOAD_PATH DWN_PATH, " + "       PRODUCT.PATH PRODUCT_PATH," + "       IMAGE.QUICKLOOK QUICKLOOK," + "       IMAGE.THUMBNAIL THUMBNAIL " + "FROM PRODUCTS PRODUCT, PRODUCT_IMAGES IMAGE " + "WHERE PRODUCT.IMAGES_ID=IMAGE.ID" ) ; products_res = products . executeQuery ( ) ; while ( products_res . next ( ) ) { Blob ql = ( Blob ) products_res . getObject ( "QUICKLOOK" ) ; Blob th = ( Blob ) products_res . getObject ( "THUMBNAIL" ) ; long id = products_res . getLong ( "ID" ) ; String download_path = products_res . getString ( "DWN_PATH" ) ; String product_path = products_res . getString ( "PRODUCT_PATH" ) ; if ( download_path == null ) { logger . error ( "No download path for product '" + product_path + "': product images not managed" ) ; continue ; } if ( ql != null ) { String ql_path = download_path . replaceAll ( "(?i)(.*).zip" , "$1-ql.gif" ) ; blobToFile ( ql , ql_path ) ; PreparedStatement product_flags_stmt = null ; try { product_flags_stmt = db_connection . prepareStatement ( "UPDATE PRODUCTS SET QUICKLOOK_PATH=? WHERE ID=?" ) ; product_flags_stmt . setString ( 1 , ql_path ) ; product_flags_stmt . setLong ( 2 , id ) ; product_flags_stmt . execute ( ) ; } finally { if ( product_flags_stmt != null ) try { product_flags_stmt . close ( ) ; } catch ( Exception e ) { logger . warn ( "Cannot close Statement !" ) ; } } } if ( th != null ) { String th_path = download_path . replaceAll ( "(?i)(.*).zip" , "$1-th.gif" ) ; blobToFile ( th , th_path ) ; PreparedStatement product_flags_stmt = null ; try { product_flags_stmt = db_connection . prepareStatement ( "UPDATE PRODUCTS SET THUMBNAIL_PATH=? WHERE ID=?" ) ; product_flags_stmt . setString ( 1 , th_path ) ; product_flags_stmt . setLong ( 2 , id ) ; product_flags_stmt . execute ( ) ; } finally { if ( product_flags_stmt != null ) try { product_flags_stmt . close ( ) ; } catch ( Exception e ) { logger . warn ( "Cannot close Statement !" ) ; } } } } PreparedStatement product_flags_stmt = null ; try { product_flags_stmt = db_connection . prepareStatement ( "CHECKPOINT DEFRAG" ) ; product_flags_stmt . execute ( ) ; } catch ( Exception e ) { logger . error ( "Cannot perform database checkpoint defrag command" , e ) ; } finally { if ( product_flags_stmt != null ) try { product_flags_stmt . close ( ) ; } catch ( Exception e ) { logger . warn ( "Cannot close Statement !" , e ) ; } } } catch ( Exception e ) { throw new CustomChangeException ( "Cannot move Blobs from product" , e ) ; } finally { if ( products_res != null ) { try { products_res . close ( ) ; } catch ( Exception e ) { logger . warn ( "Cannot close ResultSet !" ) ; } } if ( products != null ) { try { products . close ( ) ; } catch ( Exception e ) { logger . warn ( "Cannot close Statement !" ) ; } } } }
target:  This method executes: - extraction of quicklooks and thumbnails from the database to files, - references these files into the data base. remove/update processes are let to liquibase scripts.