/** * Specifying a custom username and password doesn't make sense * with a single Connection. Returns the single Connection if given * the same username and password; throws a SQLException else. */ @Override public Connection getConnection(String username, String password) throws SQLException { if (ObjectUtils.nullSafeEquals(username, getUsername()) && ObjectUtils.nullSafeEquals(password, getPassword())) { return getConnection(); } else { throw new SQLException("SingleConnectionDataSource does not support custom username and password"); } }
/** * Initialize the underlying Connection via the DriverManager. */ public void initConnection() throws SQLException { if (getUrl() == null) { throw new IllegalStateException("'url' property is required for lazily initializing a Connection"); } synchronized (this.connectionMonitor) { closeConnection(); this.target = getConnectionFromDriver(getUsername(), getPassword()); prepareConnection(this.target); if (logger.isDebugEnabled()) { logger.debug("Established shared JDBC Connection: " + this.target); } this.connection = (isSuppressClose() ? getCloseSuppressingConnectionProxy(this.target) : this.target); } }
/** * Specifying a custom username and password doesn't make sense * with a single Connection. Returns the single Connection if given * the same username and password; throws a SQLException else. */ @Override public Connection getConnection(String username, String password) throws SQLException { if (ObjectUtils.nullSafeEquals(username, getUsername()) && ObjectUtils.nullSafeEquals(password, getPassword())) { return getConnection(); } else { throw new SQLException("SingleConnectionDataSource does not support custom username and password"); } }
/** * Specifying a custom username and password doesn't make sense * with a single Connection. Returns the single Connection if given * the same username and password; throws a SQLException else. */ @Override public Connection getConnection(String username, String password) throws SQLException { if (ObjectUtils.nullSafeEquals(username, getUsername()) && ObjectUtils.nullSafeEquals(password, getPassword())) { return getConnection(); } else { throw new SQLException("SingleConnectionDataSource does not support custom username and password"); } }
/** * Initialize the underlying Connection via the DriverManager. */ public void initConnection() throws SQLException { if (getUrl() == null) { throw new IllegalStateException("'url' property is required for lazily initializing a Connection"); } synchronized (this.connectionMonitor) { closeConnection(); this.target = getConnectionFromDriver(getUsername(), getPassword()); prepareConnection(this.target); if (logger.isInfoEnabled()) { logger.info("Established shared JDBC Connection: " + this.target); } this.connection = (isSuppressClose() ? getCloseSuppressingConnectionProxy(this.target) : this.target); } }
/** * Initialize the underlying Connection via the DriverManager. */ public void initConnection() throws SQLException { if (getUrl() == null) { throw new IllegalStateException("'url' property is required for lazily initializing a Connection"); } synchronized (this.connectionMonitor) { closeConnection(); this.target = getConnectionFromDriver(getUsername(), getPassword()); prepareConnection(this.target); if (logger.isDebugEnabled()) { logger.debug("Established shared JDBC Connection: " + this.target); } this.connection = (isSuppressClose() ? getCloseSuppressingConnectionProxy(this.target) : this.target); } }