com.google.cloud.spanner.jdbc

## Class JdbcDataSource

- java.lang.Object
- - com.google.cloud.spanner.jdbc.JdbcDataSource

All Implemented Interfaces:
  Wrapper, CommonDataSource, DataSource

    public class JdbcDataSource
    extends Object
    implements DataSource

`DataSource` implementation for Google Cloud Spanner.

### Constructor Summary

Constructors
Constructor and Description
`JdbcDataSource()`

### Method Summary

All Methods Instance Methods Concrete Methods
`Boolean` `getAutocommit()`
`Connection` `getConnection()`
`Connection` `getConnection(String username, String password)`
`String` `getCredentials()`
`int` `getLoginTimeout()`
`PrintWriter` `getLogWriter()`
`Logger` `getParentLogger()`
`Boolean` `getReadonly()`
`Boolean` `getRetryAbortsInternally()`
`String` `getUrl()`
`boolean` `isClosed()` Should return true if this object has been closed
`boolean` `isWrapperFor(Class<?> iface)`
`void` `setAutocommit(Boolean autocommit)`
`void` `setCredentials(String credentials)`
`void` `setLoginTimeout(int seconds)`
`void` `setLogWriter(PrintWriter out)`
`void` `setReadonly(Boolean readonly)`
`void` `setRetryAbortsInternally(Boolean retryAbortsInternally)`
`void` `setUrl(String url)`
`<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 java.sql.Wrapper

`isWrapperFor, unwrap`

### Constructor Detail

#### JdbcDataSource

    public JdbcDataSource()

### Method Detail

#### getLogWriter

    public PrintWriter getLogWriter()
                             throws SQLException

Specified by:
  `getLogWriter` in interface `CommonDataSource`
Throws:
  `SQLException`

#### setLogWriter

    public void setLogWriter(PrintWriter out)
                      throws SQLException

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

#### setLoginTimeout

    public void setLoginTimeout(int seconds)
                         throws SQLException

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

#### getLoginTimeout

    public int getLoginTimeout()
                        throws SQLException

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

#### getParentLogger

    public Logger getParentLogger()
                           throws SQLFeatureNotSupportedException

Specified by:
  `getParentLogger` in interface `CommonDataSource`
Throws:
  `SQLFeatureNotSupportedException`

#### getConnection

    public Connection getConnection()
                             throws SQLException

Specified by:
  `getConnection` in interface `DataSource`
Throws:
  `SQLException`

#### getConnection

    public Connection getConnection(String username,
                                    String password)
                             throws SQLException

Specified by:
  `getConnection` in interface `DataSource`
Throws:
  `SQLException`

#### isClosed

    public boolean isClosed()
                     throws SQLException

Should return true if this object has been closed

Throws:
  `SQLException`

#### getUrl

    public String getUrl()

Returns:
  the JDBC URL to use for this `DataSource`.

#### setUrl

    public void setUrl(String url)

Parameters:
  `url` - The JDBC URL to use for this `DataSource`.

#### getCredentials

    public String getCredentials()

Returns:
  the credentials URL to use for this `DataSource`. If a credentials URL is specified in both the connection URL and using this property, the value in the connection URL will be used.

#### setCredentials

    public void setCredentials(String credentials)

Parameters:
  `credentials` - The credentials URL to use for this `DataSource`. If a credentials URL is specified in both the connection URL and using this property, the value in the connection URL will be used.

#### getAutocommit

    public Boolean getAutocommit()

Returns:
  the initial autocommit setting to use for this `DataSource`. If autocommit is specified in both the connection URL and using this property, the value in the connection URL will be used.

#### setAutocommit

    public void setAutocommit(Boolean autocommit)

Parameters:
  `autocommit` - The initial autocommit setting to use for this `DataSource`. If autocommit is specified in both the connection URL and using this property, the value in the connection URL will be used.

#### getReadonly

    public Boolean getReadonly()

Returns:
  the initial readonly setting to use for this `DataSource`. If readonly is specified in both the connection URL and using this property, the value in the connection URL will be used.

#### setReadonly

    public void setReadonly(Boolean readonly)

Parameters:
  `readonly` - The initial readonly setting to use for this `DataSource`. If readonly is specified in both the connection URL and using this property, the value in the connection URL will be used.

#### getRetryAbortsInternally

    public Boolean getRetryAbortsInternally()

Returns:
  the initial retryAbortsInternally setting to use for this `DataSource`. If retryAbortsInternally is specified in both the connection URL and using this property, the value in the connection URL will be used.

#### setRetryAbortsInternally

    public void setRetryAbortsInternally(Boolean retryAbortsInternally)

Parameters:
  `retryAbortsInternally` - The initial retryAbortsInternally setting to use for this `DataSource`. If retryAbortsInternally is specified in both the connection URL and using this property, the value in the connection URL will be used.

#### isWrapperFor

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

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

#### unwrap

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

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