com.github.davidmoten.rx.jdbc.ConnectionProviderFromDataSource Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of rxjava-jdbc Show documentation
Show all versions of rxjava-jdbc Show documentation
rx-java Observables for jdbc
package com.github.davidmoten.rx.jdbc;
import java.sql.Connection;
import java.sql.SQLException;
import javax.sql.DataSource;
import com.github.davidmoten.rx.jdbc.exceptions.SQLRuntimeException;
/**
* Provides database connections from a {@link DataSource}.
*/
public class ConnectionProviderFromDataSource implements ConnectionProvider {
private final DataSource dataSource;
/**
* Constructor.
*
* @param dataSource
* database connection source
*/
public ConnectionProviderFromDataSource(DataSource dataSource) {
this.dataSource = dataSource;
}
@Override
public Connection get() {
try {
return dataSource.getConnection();
} catch (SQLException e) {
throw new SQLRuntimeException(e);
}
}
@Override
public void close() {
// do nothing
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy