Package io.dropwizard.db
Interface PooledDataSourceFactory
- All Known Implementing Classes:
DataSourceFactory
public interface PooledDataSourceFactory
Interface of a factory that produces JDBC data sources
backed by the connection pool.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Configures the pool as a single connection pool.Builds a new JDBC data source backed by the connection pool and managed by Dropwizard.@Nullable String
Returns the Java class of the database driver.Returns the configuration properties for ORM tools.getUrl()
Returns the JDBC connection URL.Returns the SQL query, which is being used for the database connection health check.Returns the timeout for awaiting a response from the database during connection health checks.boolean
Whether ORM tools allowed to add comments to SQL queries.
-
Method Details
-
isAutoCommentsEnabled
boolean isAutoCommentsEnabled()Whether ORM tools allowed to add comments to SQL queries.- Returns:
true
, if allowed
-
getProperties
Returns the configuration properties for ORM tools.- Returns:
- configuration properties as a map
-
getValidationQueryTimeout
Returns the timeout for awaiting a response from the database during connection health checks.- Returns:
- the timeout as
Duration
-
getValidationQuery
Returns the SQL query, which is being used for the database connection health check.- Returns:
- the SQL query as a string
-
getDriverClass
@Nullable String getDriverClass()Returns the Java class of the database driver.- Returns:
- the JDBC driver class as a string
-
getUrl
String getUrl()Returns the JDBC connection URL.- Returns:
- the JDBC connection URL as a string
-
asSingleConnectionPool
void asSingleConnectionPool()Configures the pool as a single connection pool. It's useful for tools that use only one database connection, such as database migrations. -
build
Builds a new JDBC data source backed by the connection pool and managed by Dropwizard.- Parameters:
metricRegistry
- the application metric registryname
- name of the connection pool- Returns:
- a new JDBC data source as
ManagedDataSource
-