/// <exception cref="System.IO.IOException"/> protected internal virtual RecordReader <LongWritable, T> CreateDBRecordReader(DBInputFormat.DBInputSplit split, Configuration conf) { Type inputClass = (Type)(dbConf.GetInputClass()); try { // use database product name to determine appropriate record reader. if (dbProductName.StartsWith("ORACLE")) { // use Oracle-specific db reader. return(new OracleDBRecordReader <T>(split, inputClass, conf, CreateConnection(), GetDBConf (), conditions, fieldNames, tableName)); } else { if (dbProductName.StartsWith("MYSQL")) { // use MySQL-specific db reader. return(new MySQLDBRecordReader <T>(split, inputClass, conf, CreateConnection(), GetDBConf (), conditions, fieldNames, tableName)); } else { // Generic reader. return(new DBRecordReader <T>(split, inputClass, conf, CreateConnection(), GetDBConf (), conditions, fieldNames, tableName)); } } } catch (SQLException ex) { throw new IOException(ex.Message); } }
/// <exception cref="System.IO.IOException"/> protected internal override RecordReader <LongWritable, T> CreateDBRecordReader(DBInputFormat.DBInputSplit split, Configuration conf) { DBConfiguration dbConf = GetDBConf(); Type inputClass = (Type)(dbConf.GetInputClass()); string dbProductName = GetDBProductName(); Log.Debug("Creating db record reader for db product: " + dbProductName); try { // use database product name to determine appropriate record reader. if (dbProductName.StartsWith("MYSQL")) { // use MySQL-specific db reader. return(new MySQLDataDrivenDBRecordReader <T>(split, inputClass, conf, CreateConnection (), dbConf, dbConf.GetInputConditions(), dbConf.GetInputFieldNames(), dbConf.GetInputTableName ())); } else { // Generic reader. return(new DataDrivenDBRecordReader <T>(split, inputClass, conf, CreateConnection( ), dbConf, dbConf.GetInputConditions(), dbConf.GetInputFieldNames(), dbConf.GetInputTableName (), dbProductName)); } } catch (SQLException ex) { throw new IOException(ex.Message); } }
/// <exception cref="System.IO.IOException"/> protected internal override RecordReader <LongWritable, T> CreateDBRecordReader(DBInputFormat.DBInputSplit split, Configuration conf) { DBConfiguration dbConf = GetDBConf(); Type inputClass = (Type)(dbConf.GetInputClass()); try { // Use Oracle-specific db reader return(new OracleDataDrivenDBRecordReader <T>(split, inputClass, conf, CreateConnection (), dbConf, dbConf.GetInputConditions(), dbConf.GetInputFieldNames(), dbConf.GetInputTableName ())); } catch (SQLException ex) { throw new IOException(ex.Message); } }