org.sql2o.connectionsources.DataSourceConnectionSource Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of anima Show documentation
Show all versions of anima Show documentation
Operate the database like a stream
package org.sql2o.connectionsources;
import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.SQLException;
/**
* The default implementation of {@link ConnectionSource},
* Simply delegates all calls to specified {@link DataSource }
* Created by nickl on 09.01.17.
*/
public class DataSourceConnectionSource implements ConnectionSource {
private final DataSource dataSource;
/**
* Creates a ConnectionSource that gets connection from specified {@link DataSource }
* @param dataSource a DataSource to get connections from
*/
public DataSourceConnectionSource(DataSource dataSource) {
this.dataSource = dataSource;
}
@Override
public Connection getConnection() throws SQLException {
return dataSource.getConnection();
}
public DataSource getDataSource() {
return dataSource;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy