Package 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
Description
`JdbcDataSource()`

## Method Summary

Modifier and Type
Method
Description
`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 Details

### JdbcDataSource

public JdbcDataSource()

## Method Details

### getLogWriter

public PrintWriter getLogWriter()

Specified by:
  `getLogWriter` in interface `CommonDataSource`

### setLogWriter

public void setLogWriter(PrintWriter out)

Specified by:
  `setLogWriter` in interface `CommonDataSource`

### setLoginTimeout

public void setLoginTimeout(int seconds)

Specified by:
  `setLoginTimeout` in interface `CommonDataSource`

### getLoginTimeout

public int getLoginTimeout()

Specified by:
  `getLoginTimeout` in interface `CommonDataSource`

### 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()
Should return true if this object has been closed

### 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)

Specified by:
  `isWrapperFor` in interface `Wrapper`

### unwrap

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

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