public void init(Partition p) throws Exception {
        Class.forName(jdbcDeepJobConfig.getDriverClass());
        conn = DriverManager.getConnection(jdbcDeepJobConfig.getConnectionUrl(),
                jdbcDeepJobConfig.getUsername(),
                jdbcDeepJobConfig.getPassword());
        Statement statement = conn.createStatement();
        SelectQuery query = jdbcDeepJobConfig.getQuery();
        JdbcPartition jdbcPartition = (JdbcPartition)p;
        if(jdbcDeepJobConfig.getNumPartitions() > 1) {
            Column partitionKey = jdbcDeepJobConfig.getPartitionKey();
            query.getWhereClause().addCondition(BinaryCondition.lessThan(partitionKey, jdbcPartition.upper(), true))
                    .addCondition(BinaryCondition.greaterThan(partitionKey, jdbcPartition.lower(), true));
        }
        resultSet = statement.executeQuery(query.toString());
        // Fetches first element
        this.hasNext = resultSet.next();
    }
public void init ( Partition p ) throws Exception { Class . forName ( jdbcDeepJobConfig . getDriverClass ( ) ) ; conn = DriverManager . getConnection ( jdbcDeepJobConfig . getConnectionUrl ( ) , jdbcDeepJobConfig . getUsername ( ) , jdbcDeepJobConfig . getPassword ( ) ) ; Statement statement = conn . createStatement ( ) ; SelectQuery query = jdbcDeepJobConfig . getQuery ( ) ; JdbcPartition jdbcPartition = ( JdbcPartition ) p ; if ( jdbcDeepJobConfig . getNumPartitions ( ) > 1 ) { Column partitionKey = jdbcDeepJobConfig . getPartitionKey ( ) ; query . getWhereClause ( ) . addCondition ( BinaryCondition . lessThan ( partitionKey , jdbcPartition . upper ( ) , true ) ) . addCondition ( BinaryCondition . greaterThan ( partitionKey , jdbcPartition . lower ( ) , true ) ) ; } resultSet = statement . executeQuery ( query . toString ( ) ) ; this . hasNext = resultSet . next ( ) ; }
Initialized the reader

@param p
Spark partition.
@throws Exception