List of utility methods to do JDBC Connection Create
Connection | getSourceConnection(final Hashtable env) Specialized getConnection() which uses the environment attributes for the source DB to initialize the connection return getConnection(SOURCE_DB_URL_KEY, SOURCE_DB_USERNAME_KEY, SOURCE_DB_PASSWORD_KEY, SOURCE_DB_TYPE_KEY,
SOURCE_DB_DRIVER_KEY, env);
|
Statement | getStatement(Map get Statement Class.forName(config.get("driver")).newInstance(); Connection connection = DriverManager.getConnection(config.get("url"), config.get("user"), config.get("password")); return connection.createStatement(); |
Connection | getTargetConnection() get Target Connection return getConnection(dbResourceBundle.getString("targetDriver"), dbResourceBundle.getString("targetConnectionString"), dbResourceBundle.getString("targetUserName"), dbResourceBundle.getString("targetPassword")); |
Connection | getTestDBConnection() get Test DB Connection Class.forName("net.ucanaccess.jdbc.UcanaccessDriver"); String url = "jdbc:ucanaccess://C:/users/cgrass/Desktop/" + "USM Marketing Application/Test Database/" + "test_USMMarketingIntelligenceDatabase.accdb"; Connection conn = DriverManager.getConnection(url); return conn; |
Connection | getTRECConnection() get TREC Connection Connection connection = null; try { loadProperties(); String location = properties.getProperty("db.location"); DB_DRIVER = properties.getProperty("db.driver"); DB_USER = properties.getProperty("db.username"); DB_PASSWORD = properties.getProperty("db.password"); URL = properties.getProperty(location + ".url_trec"); ... |
Connection | getUrlConnection() get Url Connection Connection connection = null; checkprops(); Logger.global.log(Level.FINE, "DriverManager.getConnection(url)"); connection = DriverManager.getConnection(url); Logger.global.log(Level.INFO, "DriverManager.getConnection(url) passed"); Logger.global.log(Level.FINE, "==============\n\n"); return connection; |
Connection | getUserConnection() get User Connection Connection connection = null; checkprops(); Logger.global.log(Level.FINE, "DriverManager.getConnection(url, usr, pwd)"); connection = DriverManager.getConnection(url, usr, pwd); Logger.global.log(Level.INFO, "DriverManager.getConnection(url, usr, pwd) passed"); Logger.global.log(Level.FINE, "==============\n\n"); return connection; |
void | internalShutdown(String connectionString, int expectedErrorCode, String expectedSQLState) internal Shutdown try { DriverManager.getConnection(connectionString); } catch (SQLException ex) { boolean successfullShutdown = expectedErrorCode == ex.getErrorCode() && expectedSQLState.equals(ex.getSQLState()); if (!successfullShutdown) { throw ex; |
boolean | runSQLExecute(String sql, Map run SQL Execute try { Statement statement = getStatement(config); return statement.execute(sql); } catch (Exception e) { throw new RuntimeException("Failed to execute query:" + sql, e); |