Search in sources :

Example 11 with BootstrapConn

use of com.linkedin.databus.bootstrap.common.BootstrapConn in project databus by linkedin.

the class BootstrapApplierThread method getConnection.

private Connection getConnection() throws SQLException {
    Connection conn = null;
    BootstrapConn bsConn = null;
    if (_bootstrapDao == null) {
        bsConn = new BootstrapConn();
        try {
            final boolean autoCommit = false;
            bsConn.initBootstrapConn(autoCommit, java.sql.Connection.TRANSACTION_READ_COMMITTED, _config.getBootstrapDBUsername(), _config.getBootstrapDBPassword(), _config.getBootstrapDBHostname(), _config.getBootstrapDBName());
            _bootstrapDao = new BootstrapDBMetaDataDAO(bsConn, _config.getBootstrapDBHostname(), _config.getBootstrapDBUsername(), _config.getBootstrapDBPassword(), _config.getBootstrapDBName(), autoCommit);
        } catch (SQLException e) {
            LOG.fatal("Unable to get Bootstrap DB Connection", e);
            throw e;
        } catch (Exception ex) {
            LOG.fatal("Unable to get Bootstrap DB Connection", ex);
            return null;
        }
    }
    try {
        conn = _bootstrapDao.getBootstrapConn().getDBConn();
    } catch (SQLException sqlEx) {
        LOG.fatal("NOT able to get Bootstrap DB Connection", sqlEx);
        throw sqlEx;
    }
    return conn;
}
Also used : SQLException(java.sql.SQLException) BootstrapConn(com.linkedin.databus.bootstrap.common.BootstrapConn) Connection(java.sql.Connection) BootstrapDBMetaDataDAO(com.linkedin.databus.bootstrap.common.BootstrapDBMetaDataDAO) BootstrapDatabaseTooOldException(com.linkedin.databus2.core.container.request.BootstrapDatabaseTooOldException) SQLException(java.sql.SQLException)

Aggregations

BootstrapConn (com.linkedin.databus.bootstrap.common.BootstrapConn)11 BootstrapDBMetaDataDAO (com.linkedin.databus.bootstrap.common.BootstrapDBMetaDataDAO)9 SQLException (java.sql.SQLException)7 Connection (java.sql.Connection)6 ParseException (org.apache.commons.cli.ParseException)4 BootstrapConfig (com.linkedin.databus.bootstrap.common.BootstrapConfig)3 SourceStatusInfo (com.linkedin.databus.bootstrap.common.BootstrapDBMetaDataDAO.SourceStatusInfo)3 BootstrapReadOnlyConfig (com.linkedin.databus.bootstrap.common.BootstrapReadOnlyConfig)3 Checkpoint (com.linkedin.databus.core.Checkpoint)2 IOException (java.io.IOException)2 Test (org.testng.annotations.Test)2 BootstrapProcessor (com.linkedin.databus.bootstrap.server.BootstrapProcessor)1 BootstrapServerConfig (com.linkedin.databus.bootstrap.server.BootstrapServerConfig)1 BootstrapServerStaticConfig (com.linkedin.databus.bootstrap.server.BootstrapServerStaticConfig)1 BootstrapCheckpointHandler (com.linkedin.databus.core.BootstrapCheckpointHandler)1 InvalidEventException (com.linkedin.databus.core.InvalidEventException)1 KeyTypeNotImplementedException (com.linkedin.databus.core.KeyTypeNotImplementedException)1 ScnNotFoundException (com.linkedin.databus.core.ScnNotFoundException)1 ConfigLoader (com.linkedin.databus.core.util.ConfigLoader)1 InvalidConfigException (com.linkedin.databus.core.util.InvalidConfigException)1