Java Code Examples for org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection()

The following are Jave code examples for showing how to use doGetConnection() of the org.springframework.jdbc.datasource.DataSourceUtils class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: cobarclient   File:   Source Code and License Vote up 6 votes
private List<RequestDepository> fetchConnectionsAndDepositForLaterUse(
                                                                      List<ConcurrentRequest> requests) {
    List<RequestDepository> depos = new ArrayList<RequestDepository>();
    for (ConcurrentRequest request : requests) {
        DataSource dataSource = request.getDataSource();

        Connection springCon = null;
        boolean transactionAware = (dataSource instanceof TransactionAwareDataSourceProxy);
        try {
            springCon = (transactionAware ? dataSource.getConnection() : DataSourceUtils
        } catch (SQLException ex) {
            throw new CannotGetJdbcConnectionException("Could not get JDBC Connection", ex);

        RequestDepository depo = new RequestDepository();

    return depos;
Example 2
Project: holon-datastore-jdbc   File:   Source Code and License Vote up 4 votes
protected Connection getConnection(DataSource dataSource) throws SQLException {
	Connection connection = DataSourceUtils.doGetConnection(dataSource);
	LOGGER.debug(() -> "Obtained a DataSource connection: [" + connection + "]");
	return connection;
Example 3
Project: artifactory   File:   Source Code and License Vote up 4 votes
 * @return A transaction aware connection
private Connection getConnection() throws SQLException {
    return DataSourceUtils.doGetConnection(dataSource);
Example 4
Project: feilong-spring   File:   Source Code and License Vote up 2 votes
 * Test get user exclude json exception.
 * @throws SQLException
 *             the SQL exception
public void testGetUserExcludeJsonException() throws SQLException{
    Connection object = DataSourceUtils.doGetConnection(dataSource);