String jdbcDriver = getJDBCDriverName();
try {
Class.forName(getJDBCDriverName()).newInstance();
LOG.info("Loaded the JDBC driver (" + jdbcDriver + ")");
} catch (Exception e) {
throw new InternalException("Cannot load JDBC driver " + jdbcDriver, e);
}
try {
LOG.info("Trying to connect database (" + jdbcUri + ")");
conn = createConnection(conf);
LOG.info("Connected to database (" + jdbcUri + ")");
} catch (SQLException e) {
throw new InternalException("Cannot connect to database (" + jdbcUri
+ ")", e);
}
try {
if (!isInitialized()) {
LOG.info("The base tables of CatalogServer are created.");
createBaseTable();
} else {
LOG.info("The base tables of CatalogServer already is initialized.");
}
} catch (SQLException se) {
throw new InternalException(
"Cannot initialize the persistent storage of Catalog", se);
}
int dbVersion = 0;
try {
dbVersion = needUpgrade();
} catch (SQLException e) {
throw new InternalException(
"Cannot check if the DB need to be upgraded", e);
}
// if (dbVersion < VERSION) {
// LOG.info("DB Upgrade is needed");