public static Connection getConnection(Configuration config) throws SQLException { String dbtype = config.getString("DB_TYPE"); switch (dbtype) { case "mysql": dataSource.setDriverClassName("com.mysql.jdbc.Driver"); } dataSource.setUrl( "jdbc:" + dbtype + "://" + config.getString("DB_HOSTNAME") + "/" + config.getString("DB_NAME") + "?autoReconnect=true&useSSL=false&rewriteBatchedStatements=true"); dataSource.setUsername(config.getString("DB_USER")); dataSource.setPassword(config.getString("DB_PASS")); return dataSource.getConnection(); }
public boolean isLocal() { return config.getString("environment", "").equals("local"); }
public String getString(String key, String def) { return config.getString(key, def); }