Package org.springframework.jdbc.datasource

# Class AbstractDataSource

java.lang.Object
org.springframework.jdbc.datasource.AbstractDataSource

All Implemented Interfaces:
  `Wrapper`, `CommonDataSource`, `DataSource`

Direct Known Subclasses:
  `AbstractDriverBasedDataSource`, `AbstractRoutingDataSource`

public abstract class AbstractDataSource extends Object implements DataSource
Abstract base class for Spring's `DataSource` implementations, taking care of the padding.

'Padding' in the context of this class means default implementations for certain methods from the `DataSource` interface, such as `getLoginTimeout()`, `setLoginTimeout(int)`, and so forth.

Since:
  07.05.2003
Author:
  Juergen Hoeller
See Also:
  - `DriverManagerDataSource`

## Field Summary

Fields
Modifier and Type
Field
Description
`protected final org.apache.commons.logging.Log`
`logger`
Logger available to subclasses.

## Constructor Summary

Constructors
Constructor
Description
`AbstractDataSource()`

## Method Summary

Modifier and Type
Method
Description
`int`
`getLoginTimeout()`
Returns 0, indicating the default system timeout is to be used.
`PrintWriter`
`getLogWriter()`
LogWriter methods are not supported.
`Logger`
`getParentLogger()`
`boolean`
`isWrapperFor(Class<?> iface)`
`void`
`setLoginTimeout(int timeout)`
Setting a login timeout is not supported.
`void`
`setLogWriter(PrintWriter pw)`
LogWriter methods are not supported.
`<T> T`
`unwrap(Class<T> iface)`

### 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, getConnection, getConnection`

## Field Details

### logger

protected final org.apache.commons.logging.Log logger
Logger available to subclasses.

## Constructor Details

### AbstractDataSource

public AbstractDataSource()

## Method Details

### getLoginTimeout

public int getLoginTimeout() throws SQLException
Returns 0, indicating the default system timeout is to be used.

Specified by:
  `getLoginTimeout` in interface `CommonDataSource`
Specified by:
  `getLoginTimeout` in interface `DataSource`
Throws:
  `SQLException`

### setLoginTimeout

public void setLoginTimeout(int timeout) throws SQLException
Setting a login timeout is not supported.

Specified by:
  `setLoginTimeout` in interface `CommonDataSource`
Specified by:
  `setLoginTimeout` in interface `DataSource`
Throws:
  `SQLException`

### getLogWriter

public PrintWriter getLogWriter()
LogWriter methods are not supported.

Specified by:
  `getLogWriter` in interface `CommonDataSource`
Specified by:
  `getLogWriter` in interface `DataSource`

### setLogWriter

public void setLogWriter(PrintWriter pw) throws SQLException
LogWriter methods are not supported.

Specified by:
  `setLogWriter` in interface `CommonDataSource`
Specified by:
  `setLogWriter` in interface `DataSource`
Throws:
  `SQLException`

### getParentLogger

public Logger getParentLogger()

Specified by:
  `getParentLogger` in interface `CommonDataSource`

### unwrap

public <T> T unwrap(Class<T> iface) throws SQLException

Specified by:
  `unwrap` in interface `Wrapper`
Throws:
  `SQLException`

### isWrapperFor

public boolean isWrapperFor(Class<?> iface) throws SQLException

Specified by:
  `isWrapperFor` in interface `Wrapper`
Throws:
  `SQLException`