Package org.opennms.core.db.install
Class SimpleDataSource
- java.lang.Object
-
- org.opennms.core.db.install.SimpleDataSource
-
- All Implemented Interfaces:
java.sql.Wrapper
,javax.sql.CommonDataSource
,javax.sql.DataSource
public class SimpleDataSource extends java.lang.Object implements javax.sql.DataSource
-
-
Constructor Summary
Constructors Constructor Description SimpleDataSource(java.lang.String driver, java.lang.String url, java.lang.String user, java.lang.String password)
Constructor for SimpleDataSource.SimpleDataSource(JdbcDataSource ds)
Constructor for SimpleDataSource.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.sql.Connection
getConnection()
getConnectionjava.sql.Connection
getConnection(java.lang.String username, java.lang.String password)
java.lang.String
getDriver()
getDriverint
getLoginTimeout()
getLoginTimeoutjava.io.PrintWriter
getLogWriter()
getLogWriterjava.util.logging.Logger
getParentLogger()
java.lang.String
getPassword()
getPasswordjava.util.Properties
getProperties()
getPropertiesjava.lang.Integer
getTimeout()
getTimeoutjava.lang.String
getUrl()
getUrljava.lang.String
getUser()
getUserboolean
isWrapperFor(java.lang.Class<?> iface)
isWrapperForvoid
setLoginTimeout(int seconds)
void
setLogWriter(java.io.PrintWriter out)
java.lang.String
toString()
toString<T> T
unwrap(java.lang.Class<T> iface)
unwrap
-
-
-
Constructor Detail
-
SimpleDataSource
public SimpleDataSource(java.lang.String driver, java.lang.String url, java.lang.String user, java.lang.String password) throws java.lang.ClassNotFoundException
Constructor for SimpleDataSource.
- Parameters:
driver
- aString
object.url
- aString
object.user
- aString
object.password
- aString
object.- Throws:
java.lang.ClassNotFoundException
- if any.
-
SimpleDataSource
public SimpleDataSource(JdbcDataSource ds) throws java.lang.ClassNotFoundException
Constructor for SimpleDataSource.
- Parameters:
ds
- aJdbcDataSource
object.- Throws:
java.lang.ClassNotFoundException
- if any.
-
-
Method Detail
-
getConnection
public java.sql.Connection getConnection() throws java.sql.SQLException
getConnection
- Specified by:
getConnection
in interfacejavax.sql.DataSource
- Returns:
- a
Connection
object. - Throws:
java.sql.SQLException
- if any.
-
getConnection
public java.sql.Connection getConnection(java.lang.String username, java.lang.String password) throws java.sql.SQLException
- Specified by:
getConnection
in interfacejavax.sql.DataSource
- Throws:
java.sql.SQLException
-
getLogWriter
public java.io.PrintWriter getLogWriter() throws java.sql.SQLException
getLogWriter
- Specified by:
getLogWriter
in interfacejavax.sql.CommonDataSource
- Specified by:
getLogWriter
in interfacejavax.sql.DataSource
- Returns:
- a
PrintWriter
object. - Throws:
java.sql.SQLException
- if any.
-
getLoginTimeout
public int getLoginTimeout() throws java.sql.SQLException
getLoginTimeout
- Specified by:
getLoginTimeout
in interfacejavax.sql.CommonDataSource
- Specified by:
getLoginTimeout
in interfacejavax.sql.DataSource
- Returns:
- a int.
- Throws:
java.sql.SQLException
- if any.
-
setLogWriter
public void setLogWriter(java.io.PrintWriter out) throws java.sql.SQLException
- Specified by:
setLogWriter
in interfacejavax.sql.CommonDataSource
- Specified by:
setLogWriter
in interfacejavax.sql.DataSource
- Throws:
java.sql.SQLException
-
setLoginTimeout
public void setLoginTimeout(int seconds) throws java.sql.SQLException
- Specified by:
setLoginTimeout
in interfacejavax.sql.CommonDataSource
- Specified by:
setLoginTimeout
in interfacejavax.sql.DataSource
- Throws:
java.sql.SQLException
-
getParentLogger
public java.util.logging.Logger getParentLogger() throws java.sql.SQLFeatureNotSupportedException
- Specified by:
getParentLogger
in interfacejavax.sql.CommonDataSource
- Throws:
java.sql.SQLFeatureNotSupportedException
-
unwrap
public <T> T unwrap(java.lang.Class<T> iface) throws java.sql.SQLException
unwrap
- Specified by:
unwrap
in interfacejava.sql.Wrapper
- Type Parameters:
T
- a T object.- Parameters:
iface
- aClass
object.- Returns:
- a T object.
- Throws:
java.sql.SQLException
- if any.
-
isWrapperFor
public boolean isWrapperFor(java.lang.Class<?> iface) throws java.sql.SQLException
isWrapperFor
- Specified by:
isWrapperFor
in interfacejava.sql.Wrapper
- Parameters:
iface
- aClass
object.- Returns:
- a boolean.
- Throws:
java.sql.SQLException
- if any.
-
getDriver
public java.lang.String getDriver()
getDriver
- Returns:
- a
String
object.
-
getPassword
public java.lang.String getPassword()
getPassword
- Returns:
- a
String
object.
-
getTimeout
public java.lang.Integer getTimeout()
getTimeout
- Returns:
- a
Integer
object.
-
getUrl
public java.lang.String getUrl()
getUrl
- Returns:
- a
String
object.
-
getUser
public java.lang.String getUser()
getUser
- Returns:
- a
String
object.
-
getProperties
public java.util.Properties getProperties()
getProperties
- Returns:
- a
Properties
object.
-
toString
public java.lang.String toString()
toString
- Overrides:
toString
in classjava.lang.Object
- Returns:
- a
String
object.
-
-