java.lang.Object
org.itsallcode.jdbc.DataSourceConnectionFactory
This class connects to a database using a
DataSource and returns new
SimpleConnections.
Create a new instance using create(String, DataSource) or
create(DbDialect, DataSource).
-
Method Summary
Modifier and TypeMethodDescriptionstatic DataSourceConnectionFactorycreate(String jdbcUrl, DataSource dataSource) Create a newDataSourceConnectionFactoryusing the given JDBC URL and data source.static DataSourceConnectionFactorycreate(DbDialect dialect, DataSource dataSource) Create a newDataSourceConnectionFactoryusing the given dialect and data source.Get a newSimpleConnectionfrom theDataSource.
-
Method Details
-
create
Create a newDataSourceConnectionFactoryusing the given JDBC URL and data source.Note: The data source will not be closed automatically. It is the caller's responsibility to close the data source.
- Parameters:
jdbcUrl- JDBC URL used to determine the database dialectdataSource- data source- Returns:
- new connection factory
-
create
Create a newDataSourceConnectionFactoryusing the given dialect and data source.Note: The data source will not be closed automatically. It is the caller's responsibility to close the data source.
- Parameters:
dialect- database dialectdataSource- data source- Returns:
- new connection factory
-
getConnection
Get a newSimpleConnectionfrom theDataSource.- Returns:
- new connection
-