4 Replies Latest reply on Feb 4, 2017 8:14 AM by João Santana

    Dynamic sql with JbdcItemReader/JbdcItemWriter

    João Santana Newbie

      Hi all, my job changes the source table every day... how i can put the new table in sql property each execution. i trying:

      public class PigeonJdbcItemReader extends JdbcItemReader {
          protected String prefix;
          protected String sql;
          public void open(Serializable checkpoint) throws Exception {
              DecimalFormat formater = new DecimalFormat("00");         
              String sufix = formater.format(LocalDate.now().getYear()) + "_" + formater.format(LocalDate.now().getMonthValue()) + "_" + LocalDate.now().getDayOfMonth();
              sql = sql.replaceAll("src_tbl", prefix + sufix);


      so... in JdbcItemReader.open the sql stay with <src_tbl> yet... and a sql error certein