Class DBConfiguration
java.lang.Object
org.apache.hadoop.mapreduce.lib.db.DBConfiguration
- Direct Known Subclasses:
DBConfiguration
A container for configuration property names for jobs with DB input/output.
The job can be configured using the static methods in this class,
DBInputFormat, and DBOutputFormat.
Alternatively, the properties can be set in the configuration with proper
values.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe JDBC Driver class namestatic final StringInput query to get the max and min values of the jdbc.input.querystatic final StringClass name implementing DBWritable which will hold input tuplesstatic final StringWHERE clause in the input SELECT statementstatic final StringInput query to get the count of recordsstatic final StringField names in the Input tablestatic final StringORDER BY clause in the input SELECT statementstatic final StringWhole input query, exluding LIMIT...OFFSETstatic final StringInput table namestatic final StringNumber of fields in the Output tablestatic final StringField names in the Output tablestatic final StringOutput table namestatic final StringPassword to access the databasestatic final StringJDBC Database access URLstatic final StringUser name to access the database -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidconfigureDB(Configuration job, String driverClass, String dbUrl) Sets the DB access related fields in the JobConf.static voidconfigureDB(Configuration conf, String driverClass, String dbUrl, String userName, String passwd) Sets the DB access related fields in theConfiguration.getConf()Returns a connection object o the DBClass<?>String[]intString[]voidsetInputBoundingQuery(String query) voidsetInputClass(Class<? extends DBWritable> inputClass) voidsetInputConditions(String conditions) voidsetInputCountQuery(String query) voidsetInputFieldNames(String... fieldNames) voidsetInputOrderBy(String orderby) voidsetInputQuery(String query) voidsetInputTableName(String tableName) voidsetOutputFieldCount(int fieldCount) voidsetOutputFieldNames(String... fieldNames) voidsetOutputTableName(String tableName)
-
Field Details
-
DRIVER_CLASS_PROPERTY
The JDBC Driver class name- See Also:
-
URL_PROPERTY
JDBC Database access URL- See Also:
-
USERNAME_PROPERTY
User name to access the database- See Also:
-
PASSWORD_PROPERTY
Password to access the database- See Also:
-
INPUT_TABLE_NAME_PROPERTY
Input table name- See Also:
-
INPUT_FIELD_NAMES_PROPERTY
Field names in the Input table- See Also:
-
INPUT_CONDITIONS_PROPERTY
WHERE clause in the input SELECT statement- See Also:
-
INPUT_ORDER_BY_PROPERTY
ORDER BY clause in the input SELECT statement- See Also:
-
INPUT_QUERY
Whole input query, exluding LIMIT...OFFSET- See Also:
-
INPUT_COUNT_QUERY
Input query to get the count of records- See Also:
-
INPUT_BOUNDING_QUERY
Input query to get the max and min values of the jdbc.input.query- See Also:
-
INPUT_CLASS_PROPERTY
Class name implementing DBWritable which will hold input tuples- See Also:
-
OUTPUT_TABLE_NAME_PROPERTY
Output table name- See Also:
-
OUTPUT_FIELD_NAMES_PROPERTY
Field names in the Output table- See Also:
-
OUTPUT_FIELD_COUNT_PROPERTY
Number of fields in the Output table- See Also:
-
-
Constructor Details
-
DBConfiguration
-
-
Method Details
-
configureDB
public static void configureDB(Configuration conf, String driverClass, String dbUrl, String userName, String passwd) Sets the DB access related fields in theConfiguration.- Parameters:
conf- the configurationdriverClass- JDBC Driver class namedbUrl- JDBC DB access URL.userName- DB access usernamepasswd- DB access passwd
-
configureDB
Sets the DB access related fields in the JobConf.- Parameters:
job- the jobdriverClass- JDBC Driver class namedbUrl- JDBC DB access URL.
-
getConnection
Returns a connection object o the DB- Throws:
ClassNotFoundExceptionSQLException
-
getConf
-
getInputTableName
-
setInputTableName
-
getInputFieldNames
-
setInputFieldNames
-
getInputConditions
-
setInputConditions
-
getInputOrderBy
-
setInputOrderBy
-
getInputQuery
-
setInputQuery
-
getInputCountQuery
-
setInputCountQuery
-
setInputBoundingQuery
-
getInputBoundingQuery
-
getInputClass
-
setInputClass
-
getOutputTableName
-
setOutputTableName
-
getOutputFieldNames
-
setOutputFieldNames
-
setOutputFieldCount
public void setOutputFieldCount(int fieldCount) -
getOutputFieldCount
public int getOutputFieldCount()
-