handlerClassName = context.getString(
RepoConfigurationConstants.SYSCFG_REPO_JDBC_HANDLER);
if (handlerClassName == null || handlerClassName.trim().length() == 0) {
throw new SqoopException(RepositoryError.JDBCREPO_0001,
RepoConfigurationConstants.SYSCFG_REPO_JDBC_HANDLER);
}
connectionUrl = context.getString(
RepoConfigurationConstants.SYSCFG_REPO_JDBC_URL);
driverClassName = context.getString(
RepoConfigurationConstants.SYSCFG_REPO_JDBC_DRIVER);
String jdbcUserName = context.getString(
RepoConfigurationConstants.SYSCFG_REPO_JDBC_USER);
String jdbcPassword = context.getString(
RepoConfigurationConstants.SYSCFG_REPO_JDBC_PASSWORD);
connectionProperties = new Properties();
Map<String, String> params = context.getNestedProperties(
RepoConfigurationConstants.PREFIX_SYSCFG_REPO_JDBC_PROPERTIES);
for (Map.Entry<String, String> entry : params.entrySet()) {
connectionProperties.setProperty(entry.getKey(), entry.getValue());
}
if (jdbcUserName != null) {
Object oldUser = connectionProperties.put("user", jdbcUserName);
if (oldUser != null) {
LOG.warn("Overriding user (" + oldUser
+ ") with explicitly specified user (" + jdbcUserName + ")");
}
}
if (jdbcPassword != null) {
Object oldPassword = connectionProperties.put("password", jdbcPassword);
if (oldPassword != null) {
LOG.warn("Overriding password from jdbc connection properties with "
+ "explicitly specified password.");
}
}
String txIsolation = context.getString(
RepoConfigurationConstants.SYSCFG_REPO_JDBC_TX_ISOLATION);
if (txIsolation == null || txIsolation.trim().length() == 0) {
throw new SqoopException(RepositoryError.JDBCREPO_0004);
}
try {
transactionIsolation = JdbcTransactionIsolation.getByName(txIsolation);
} catch (IllegalArgumentException ex) {
throw new SqoopException(RepositoryError.JDBCREPO_0004,
txIsolation, ex);
}
String maxConnStr = context.getString(
RepoConfigurationConstants.SYSCFG_REPO_JDBC_MAX_CONN);
if (maxConnStr == null || maxConnStr.trim().length() == 0) {
throw new SqoopException(RepositoryError.JDBCREPO_0005,
RepoConfigurationConstants.SYSCFG_REPO_JDBC_MAX_CONN);
}
int maxConnInt = 0;
try {
maxConnInt = Integer.parseInt(maxConnStr);
} catch (NumberFormatException ex) {
throw new SqoopException(RepositoryError.JDBCREPO_0005, maxConnStr, ex);
}
if (maxConnInt <= 0) {
throw new SqoopException(RepositoryError.JDBCREPO_0005, maxConnStr);
}
maxConnections = maxConnInt;
if (LOG.isInfoEnabled()) {