Example usage for org.springframework.jdbc.datasource SingleConnectionDataSource initConnection

List of usage examples for org.springframework.jdbc.datasource SingleConnectionDataSource initConnection

Introduction

In this page you can find the example usage for org.springframework.jdbc.datasource SingleConnectionDataSource initConnection.

Prototype

public void initConnection() throws SQLException 

Source Link

Document

Initialize the underlying Connection via the DriverManager.

Usage

From source file:ru.adios.budgeter.BundleProvider.java

private static SingleConnectionDataSource createDataSource(String url) {
    final SingleConnectionDataSource dataSource = new SingleConnectionDataSource(url, true) {
        @Override/*from  w ww  .  ja v a2 s .  co m*/
        protected Connection getCloseSuppressingConnectionProxy(Connection target) {
            return new DelegatingConnectionProxy(target);
        }
    };
    dataSource.setAutoCommit(true);
    dataSource.setDriverClassName("org.sqldroid.SQLDroidDriver");
    try {
        dataSource.initConnection();
    } catch (SQLException ex) {
        throw new DataAccessResourceFailureException("Unable to initialize SingleConnectionDataSource", ex);
    }
    return dataSource;
}