private void executeJdbcStatements ( Connection connection , String configName , String statements , String description ) { Statement stmt = createStatement ( configName , connection ) ; try { log . debug ( "Executing statement [" + description + "]" ) ; List < String > stmtsToExecute = Stream . of ( statements . split ( ";" ) ) . map ( String :: trim ) . filter ( s -> s . length ( ) > 0 ) . collect ( Collectors . toList ( ) ) ; if ( log . isTraceEnabled ( ) ) { log . trace ( "These statements will be executed:" ) ; stmtsToExecute . forEach ( s -> log . trace ( "Statement: [" + s + "]" ) ) ; } for ( String currentStatement : stmtsToExecute ) { stmt . execute ( currentStatement ) ; log . trace ( "Executing statement: " + currentStatement + " OK!" ) ; } } catch ( SQLException e ) { throw new ChorusException ( String . format ( "Failed while executing statement [%s] on database + %s [%s]" , description , configName , e . toString ( ) , e ) ) ; } }
Execute one or more SQL statements