Package org.apache.log.output.db
Class DefaultDataSource
java.lang.Object
org.apache.log.output.db.DefaultDataSource
- All Implemented Interfaces:
Wrapper
,CommonDataSource
,DataSource
A basic datasource that doesn't do any pooling but just wraps
around default mechanisms.
- Author:
- Peter Donald
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate int
private PrintWriter
private final String
private final String
private final String
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAttempt to establish a database connection.getConnection
(String username, String password) Attempt to establish a database connection.int
Gets the maximum time in seconds that this data source can wait while attempting to connect to a database.Get the log writer for this data source.boolean
isWrapperFor
(Class iface) void
setLoginTimeout
(int loginTimeout) Sets the maximum time in seconds that this data source will wait while attempting to connect to a database.void
setLogWriter
(PrintWriter logWriter) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface javax.sql.CommonDataSource
createShardingKeyBuilder
Methods inherited from interface javax.sql.DataSource
createConnectionBuilder
-
Field Details
-
m_username
-
m_password
-
m_url
-
m_logWriter
-
m_loginTimeout
private int m_loginTimeout
-
-
Constructor Details
-
DefaultDataSource
-
-
Method Details
-
getConnection
Attempt to establish a database connection.- Specified by:
getConnection
in interfaceDataSource
- Returns:
- the Connection
- Throws:
SQLException
-
getConnection
Attempt to establish a database connection.- Specified by:
getConnection
in interfaceDataSource
- Returns:
- the Connection
- Throws:
SQLException
-
getLoginTimeout
Gets the maximum time in seconds that this data source can wait while attempting to connect to a database.- Specified by:
getLoginTimeout
in interfaceCommonDataSource
- Specified by:
getLoginTimeout
in interfaceDataSource
- Returns:
- the login time
- Throws:
SQLException
-
getLogWriter
Get the log writer for this data source.- Specified by:
getLogWriter
in interfaceCommonDataSource
- Specified by:
getLogWriter
in interfaceDataSource
- Returns:
- the LogWriter
- Throws:
SQLException
-
setLoginTimeout
Sets the maximum time in seconds that this data source will wait while attempting to connect to a database.- Specified by:
setLoginTimeout
in interfaceCommonDataSource
- Specified by:
setLoginTimeout
in interfaceDataSource
- Parameters:
loginTimeout
- the loging timeout in seconds- Throws:
SQLException
-
setLogWriter
- Specified by:
setLogWriter
in interfaceCommonDataSource
- Specified by:
setLogWriter
in interfaceDataSource
- Throws:
SQLException
-
unwrap
- Specified by:
unwrap
in interfaceWrapper
- Throws:
SQLException
-
isWrapperFor
- Specified by:
isWrapperFor
in interfaceWrapper
- Throws:
SQLException
-
getParentLogger
- Specified by:
getParentLogger
in interfaceCommonDataSource
- Throws:
SQLFeatureNotSupportedException
-