/** * Tries to acquire a {@link XAConnection} through a {@link XADataSource} even when the server is overloaded. * * @param xaDataSource the XA data source * @return a XA connection to the XA data source */ public static XAConnection getXAConnection(final XADataSource xaDataSource) throws SQLException { return callWithRetry(xaDataSource::getXAConnection); }
/** * Gets a database connection, retrying if the server says it's overloaded. * * @since 5.9.3 */ public static Connection getConnection(String url, String user, String password) throws SQLException { return JDBCUtils.getConnection(url, user, password); }
/** * Tries to acquire a {@link Connection} through a {@link DataSource} even when the server is overloaded. * * @param dataSource the data source * @return a connection to the data source */ public static Connection getConnection(final DataSource dataSource) throws SQLException { return callWithRetry(dataSource::getConnection); }
/** * Tries to acquire a {@link Connection} through the {@link DriverManager} even when the server is overloaded. * * @param url a database url of the form <code>jdbc:<em>subprotocol</em>:<em>subname</em></code> * @param user the database user on whose behalf the connection is being made * @param password the user's password * @return a connection to the URL */ public static Connection getConnection(final String url, final String user, final String password) throws SQLException { return callWithRetry(() -> DriverManager.getConnection(url, user, password)); }