/** * This implementation delegates to the {@code getConnection(username, password)} * method of the target DataSource, passing in the specified user credentials. * If the specified username is empty, it will simply delegate to the standard * {@code getConnection()} method of the target DataSource. * @param username the username to use * @param password the password to use * @return the Connection * @see javax.sql.DataSource#getConnection(String, String) * @see javax.sql.DataSource#getConnection() */ protected Connection doGetConnection(@Nullable String username, @Nullable String password) throws SQLException { Assert.state(getTargetDataSource() != null, "'targetDataSource' is required"); if (StringUtils.hasLength(username)) { return getTargetDataSource().getConnection(username, password); } else { return getTargetDataSource().getConnection(); } }
/** * This implementation delegates to the {@code getConnection(username, password)} * method of the target DataSource, passing in the specified user credentials. * If the specified username is empty, it will simply delegate to the standard * {@code getConnection()} method of the target DataSource. * @param username the username to use * @param password the password to use * @return the Connection * @see javax.sql.DataSource#getConnection(String, String) * @see javax.sql.DataSource#getConnection() */ protected Connection doGetConnection(String username, String password) throws SQLException { Assert.state(getTargetDataSource() != null, "'targetDataSource' is required"); if (StringUtils.hasLength(username)) { return getTargetDataSource().getConnection(username, password); } else { return getTargetDataSource().getConnection(); } }
/** * This implementation delegates to the {@code getConnection(username, password)} * method of the target DataSource, passing in the specified user credentials. * If the specified username is empty, it will simply delegate to the standard * {@code getConnection()} method of the target DataSource. * @param username the username to use * @param password the password to use * @return the Connection * @see javax.sql.DataSource#getConnection(String, String) * @see javax.sql.DataSource#getConnection() */ protected Connection doGetConnection(@Nullable String username, @Nullable String password) throws SQLException { Assert.state(getTargetDataSource() != null, "'targetDataSource' is required"); if (StringUtils.hasLength(username)) { return getTargetDataSource().getConnection(username, password); } else { return getTargetDataSource().getConnection(); } }