@Override public ConnectionProvider getInitializedConnectionProvider() throws InvalidConnectionException { logger.debug("Creating new jdbc connection"); final DriverConnectionProvider connectionProvider = new DriverConnectionProvider(); connectionProvider.setDriver(connectionInfo.getDriver()); connectionProvider.setUrl(connectionInfo.getUrl()); final Properties properties = connectionInfo.getProperties(); final Enumeration<Object> keys = properties.keys(); while (keys.hasMoreElements()) { final String key = (String) keys.nextElement(); final String value = properties.getProperty(key); connectionProvider.setProperty(key, value); } logger.debug("Opening connection"); try { final Connection connection = connectionProvider.createConnection(connectionInfo.getUser(), connectionInfo.getPass()); connection.close(); } catch (SQLException e) { throw new InvalidConnectionException( "JdbcConnection: Found SQLException: " + Util.getExceptionDescription(e), e); } logger.debug("Connection opened"); return connectionProvider; }
public boolean equals(final Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } final JdbcConnection that = (JdbcConnection) o; if (connectionInfo != null ? !connectionInfo.equals(that.connectionInfo) : that.connectionInfo != null) { return false; } return true; }
public int hashCode() { return connectionInfo != null ? connectionInfo.hashCode() : 0; }
public String getUserField() { return connectionInfo.getUserField(); }
public String getPasswordField() { return connectionInfo.getPasswordField(); }