public class SimpleDataSource extends Object implements DataSource
Constructor and Description |
---|
SimpleDataSource(JdbcDataSource ds)
Constructor for SimpleDataSource.
|
SimpleDataSource(String driver,
String url,
String user,
String password)
Constructor for SimpleDataSource.
|
Modifier and Type | Method and Description |
---|---|
Connection |
getConnection()
getConnection
|
Connection |
getConnection(String username,
String password) |
String |
getDriver()
getDriver
|
int |
getLoginTimeout()
getLoginTimeout
|
PrintWriter |
getLogWriter()
getLogWriter
|
Logger |
getParentLogger() |
String |
getPassword()
getPassword
|
Properties |
getProperties()
getProperties
|
Integer |
getTimeout()
getTimeout
|
String |
getUrl()
getUrl
|
String |
getUser()
getUser
|
boolean |
isWrapperFor(Class<?> iface)
isWrapperFor
|
void |
setLoginTimeout(int seconds) |
void |
setLogWriter(PrintWriter out) |
String |
toString()
toString
|
<T> T |
unwrap(Class<T> iface)
unwrap
|
public SimpleDataSource(String driver, String url, String user, String password) throws ClassNotFoundException
Constructor for SimpleDataSource.
driver
- a String
object.url
- a String
object.user
- a String
object.password
- a String
object.ClassNotFoundException
- if any.public SimpleDataSource(JdbcDataSource ds) throws ClassNotFoundException
Constructor for SimpleDataSource.
ds
- a JdbcDataSource
object.ClassNotFoundException
- if any.public Connection getConnection() throws SQLException
getConnection
getConnection
in interface DataSource
Connection
object.SQLException
- if any.public Connection getConnection(String username, String password) throws SQLException
getConnection
in interface DataSource
SQLException
public PrintWriter getLogWriter() throws SQLException
getLogWriter
getLogWriter
in interface CommonDataSource
PrintWriter
object.SQLException
- if any.public int getLoginTimeout() throws SQLException
getLoginTimeout
getLoginTimeout
in interface CommonDataSource
SQLException
- if any.public void setLogWriter(PrintWriter out) throws SQLException
setLogWriter
in interface CommonDataSource
SQLException
public void setLoginTimeout(int seconds) throws SQLException
setLoginTimeout
in interface CommonDataSource
SQLException
public Logger getParentLogger() throws SQLFeatureNotSupportedException
getParentLogger
in interface CommonDataSource
SQLFeatureNotSupportedException
public <T> T unwrap(Class<T> iface) throws SQLException
unwrap
unwrap
in interface Wrapper
T
- a T object.iface
- a Class
object.SQLException
- if any.public boolean isWrapperFor(Class<?> iface) throws SQLException
isWrapperFor
isWrapperFor
in interface Wrapper
iface
- a Class
object.SQLException
- if any.public Properties getProperties()
getProperties
Properties
object.Copyright © 2018. All rights reserved.