@@ -0,0 +1,2803 @@
+package de.tblsoft.solr.pipeline;%0A%0Aimport de.tblsoft.solr.pipeline.bean.Document;%0Aimport de.tblsoft.solr.util.DateUtils;%0A%0Aimport java.sql.*;%0Aimport java.time.ZoneId;%0Aimport java.time.format.DateTimeFormatter;%0A%0A/**%0A * Created by tblsoft on 10.11.18.%0A */%0Apublic class JdbcReader extends AbstractReader %7B%0A%0A    @Override%0A    public void read() %7B%0A        String sql = getProperty(%22sql%22, null);%0A        String jdbcDriver = getProperty(%22jdbcDriver%22, %22com.mysql.jdbc.Driver%22);%0A        String user = getProperty(%22user%22, null);%0A        String password = getProperty(%22password%22, null);%0A        String jdbcUrl = getProperty(%22jdbcUrl%22, null);%0A        String zoneId = getProperty(%22zoneId%22, %22UTC%22);%0A%0A        boolean addMeta = getPropertyAsBoolean(%22addMeta%22, false);%0A        Long maxRows = getPropertyAsInteger(%22maxRows%22, Long.MAX_VALUE);%0A%0A        Connection conn = null;%0A        Statement stmt = null;%0A        try %7B%0A            Class.forName(jdbcDriver);%0A            conn = DriverManager.getConnection(jdbcUrl, user, password);%0A            stmt = conn.createStatement();%0A%0A            ResultSet rs = stmt.executeQuery(sql);%0A            int columnCount = rs.getMetaData().getColumnCount();%0A            long rowNumber = 0;%0A            while (rs.next()) %7B%0A                if (rowNumber %3E= maxRows) %7B%0A                    break;%0A                %7D%0A                rowNumber++;%0A                Document document = new Document();%0A                for (int i = 1; i %3C= columnCount; i++) %7B%0A                    String key = rs.getMetaData().getColumnLabel(i);%0A                    String value = rs.getString(i);%0A                    String datatype = rs.getMetaData().getColumnClassName(i);%0A%0A                    if(datatype.equals(%22java.sql.Timestamp%22) && value != null) %7B%0A                        value =  DateUtils.timestamp2String(rs.getTimestamp(i),zoneId);%0A                    %7D%0A%0A                    if(value != null) %7B%0A                        document.addField(key, value);%0A                    %7D%0A                %7D%0A                if (addMeta) %7B%0A                    document.addField(%22rowNumber%22, String.valueOf(rowNumber));%0A                %7D%0A                executer.document(document);%0A%0A            %7D%0A            rs.close();%0A            stmt.close();%0A            conn.close();%0A        %7D catch (SQLException se) %7B%0A            throw new RuntimeException(se);%0A        %7D catch (Exception e) %7B%0A            throw new RuntimeException(e);%0A        %7D finally %7B%0A            try %7B%0A                if (stmt != null)%0A                    stmt.close();%0A            %7D catch (SQLException se2) %7B%0A                try %7B%0A                    if (conn != null)%0A                        conn.close();%0A                %7D catch (SQLException se) %7B%0A                    throw new RuntimeException(se);%0A                %7D%0A            %7D%0A        %7D%0A%0A    %7D%0A%0A%7D%0A

add a jdbc reader