Class DriverManagerDataSource
java.lang.Object
io.micronaut.configuration.jdbc.unpooled.DriverManagerDataSource
- All Implemented Interfaces:
Wrapper, CommonDataSource, DataSource
A simple unpooled
DataSource backed by DriverManager.- Since:
- 7.0.0
- Author:
- Micronaut
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDataSourceProperty(String key, String value) Add a single datasource property.getConnection(String username, String password) intgetName()getUrl()booleanbooleanisWrapperFor(Class<?> iface) voidsetDataSourceProperties(Map<String, String> properties) Replace all configured datasource properties.voidsetDriverClassName(String driverClassName) voidsetLoginTimeout(int seconds) voidsetLogWriter(PrintWriter out) voidsetPassword(String password) voidvoidsetUsername(String username) <T> TMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface CommonDataSource
createShardingKeyBuilderMethods inherited from interface DataSource
createConnectionBuilder
-
Constructor Details
-
DriverManagerDataSource
- Parameters:
configuration- The datasource configuration
-
-
Method Details
-
getName
- Returns:
- The datasource name
-
getUrl
- Returns:
- The JDBC URL
-
setUrl
- Parameters:
url- The JDBC URL
-
getDriverClassName
- Returns:
- The configured driver class name
-
setDriverClassName
- Parameters:
driverClassName- The configured driver class name
-
getUsername
- Returns:
- The configured username
-
setUsername
- Parameters:
username- The configured username
-
getPassword
- Returns:
- The configured password
-
setPassword
- Parameters:
password- The configured password
-
getDataSourceProperties
- Returns:
- Additional datasource properties passed to the JDBC driver
-
setDataSourceProperties
-
addDataSourceProperty
-
hasDataSourceProperty
- Parameters:
key- The property name- Returns:
- Whether the configured datasource properties contain the given key
-
getConnection
- Specified by:
getConnectionin interfaceDataSource- Throws:
SQLException
-
getConnection
- Specified by:
getConnectionin interfaceDataSource- Throws:
SQLException
-
getLogWriter
- Specified by:
getLogWriterin interfaceCommonDataSource- Specified by:
getLogWriterin interfaceDataSource- Throws:
SQLException
-
setLogWriter
- Specified by:
setLogWriterin interfaceCommonDataSource- Specified by:
setLogWriterin interfaceDataSource- Throws:
SQLException
-
setLoginTimeout
public void setLoginTimeout(int seconds) - Specified by:
setLoginTimeoutin interfaceCommonDataSource- Specified by:
setLoginTimeoutin interfaceDataSource
-
getLoginTimeout
- Specified by:
getLoginTimeoutin interfaceCommonDataSource- Specified by:
getLoginTimeoutin interfaceDataSource- Throws:
SQLException
-
getParentLogger
- Specified by:
getParentLoggerin interfaceCommonDataSource- Throws:
SQLFeatureNotSupportedException
-
unwrap
- Specified by:
unwrapin interfaceWrapper- Throws:
SQLException
-
isWrapperFor
- Specified by:
isWrapperForin interfaceWrapper
-