Package org.opennms.core.db.install
Class SimpleDataSource
- java.lang.Object
-
- org.opennms.core.db.install.SimpleDataSource
-
- All Implemented Interfaces:
Wrapper
,CommonDataSource
,DataSource
public class SimpleDataSource extends Object implements DataSource
-
-
Constructor Summary
Constructors Constructor Description SimpleDataSource(String driver, String url, String user, String password)
Constructor for SimpleDataSource.SimpleDataSource(JdbcDataSource ds)
Constructor for SimpleDataSource.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Connection
getConnection()
getConnectionConnection
getConnection(String username, String password)
String
getDriver()
getDriverint
getLoginTimeout()
getLoginTimeoutPrintWriter
getLogWriter()
getLogWriterLogger
getParentLogger()
String
getPassword()
getPasswordProperties
getProperties()
getPropertiesInteger
getTimeout()
getTimeoutString
getUrl()
getUrlString
getUser()
getUserboolean
isWrapperFor(Class<?> iface)
isWrapperForvoid
setLoginTimeout(int seconds)
void
setLogWriter(PrintWriter out)
String
toString()
toString<T> T
unwrap(Class<T> iface)
unwrap-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface javax.sql.CommonDataSource
createShardingKeyBuilder
-
Methods inherited from interface javax.sql.DataSource
createConnectionBuilder
-
-
-
-
Constructor Detail
-
SimpleDataSource
public SimpleDataSource(String driver, String url, String user, String password) throws ClassNotFoundException
Constructor for SimpleDataSource.
- Parameters:
driver
- aString
object.url
- aString
object.user
- aString
object.password
- aString
object.- Throws:
ClassNotFoundException
- if any.
-
SimpleDataSource
public SimpleDataSource(JdbcDataSource ds) throws ClassNotFoundException
Constructor for SimpleDataSource.
- Parameters:
ds
- aJdbcDataSource
object.- Throws:
ClassNotFoundException
- if any.
-
-
Method Detail
-
getConnection
public Connection getConnection() throws SQLException
getConnection
- Specified by:
getConnection
in interfaceDataSource
- Returns:
- a
Connection
object. - Throws:
SQLException
- if any.
-
getConnection
public Connection getConnection(String username, String password) throws SQLException
- Specified by:
getConnection
in interfaceDataSource
- Throws:
SQLException
-
getLogWriter
public PrintWriter getLogWriter() throws SQLException
getLogWriter
- Specified by:
getLogWriter
in interfaceCommonDataSource
- Specified by:
getLogWriter
in interfaceDataSource
- Returns:
- a
PrintWriter
object. - Throws:
SQLException
- if any.
-
getLoginTimeout
public int getLoginTimeout() throws SQLException
getLoginTimeout
- Specified by:
getLoginTimeout
in interfaceCommonDataSource
- Specified by:
getLoginTimeout
in interfaceDataSource
- Returns:
- a int.
- Throws:
SQLException
- if any.
-
setLogWriter
public void setLogWriter(PrintWriter out) throws SQLException
- Specified by:
setLogWriter
in interfaceCommonDataSource
- Specified by:
setLogWriter
in interfaceDataSource
- Throws:
SQLException
-
setLoginTimeout
public void setLoginTimeout(int seconds) throws SQLException
- Specified by:
setLoginTimeout
in interfaceCommonDataSource
- Specified by:
setLoginTimeout
in interfaceDataSource
- Throws:
SQLException
-
getParentLogger
public Logger getParentLogger() throws SQLFeatureNotSupportedException
- Specified by:
getParentLogger
in interfaceCommonDataSource
- Throws:
SQLFeatureNotSupportedException
-
unwrap
public <T> T unwrap(Class<T> iface) throws SQLException
unwrap
- Specified by:
unwrap
in interfaceWrapper
- Type Parameters:
T
- a T object.- Parameters:
iface
- aClass
object.- Returns:
- a T object.
- Throws:
SQLException
- if any.
-
isWrapperFor
public boolean isWrapperFor(Class<?> iface) throws SQLException
isWrapperFor
- Specified by:
isWrapperFor
in interfaceWrapper
- Parameters:
iface
- aClass
object.- Returns:
- a boolean.
- Throws:
SQLException
- if any.
-
getProperties
public Properties getProperties()
getProperties
- Returns:
- a
Properties
object.
-
-