java.lang.Object
org.itsallcode.jdbc.DataSourceConnectionFactory
This class connects to a database using a
DataSource
and returns new
SimpleConnection
s.
Create a new instance using create(String, DataSource)
or
create(DbDialect, DataSource)
.
-
Method Summary
Modifier and TypeMethodDescriptionstatic DataSourceConnectionFactory
create
(String jdbcUrl, DataSource dataSource) Create a newDataSourceConnectionFactory
using the given JDBC URL and data source.static DataSourceConnectionFactory
create
(DbDialect dialect, DataSource dataSource) Create a newDataSourceConnectionFactory
using the given dialect and data source.Get a newSimpleConnection
from theDataSource
.
-
Method Details
-
create
Create a newDataSourceConnectionFactory
using 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 newDataSourceConnectionFactory
using 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 newSimpleConnection
from theDataSource
.- Returns:
- new connection
-