nl.topicus.jdbc

## Class CloudSpannerDataSource

- java.lang.Object
- - nl.topicus.jdbc.metadata.AbstractCloudSpannerWrapper
  - - nl.topicus.jdbc.CloudSpannerDataSource

All Implemented Interfaces:
  Wrapper, CommonDataSource, DataSource

Direct Known Subclasses:
  CloudSpannerConnectionPoolDataSource, CloudSpannerXADataSource

    public class CloudSpannerDataSource
    extends AbstractCloudSpannerWrapper
    implements DataSource

A basic DataSource implementation for getting a Connection to a Google Cloud Spanner database.

Author:
  loite

### Constructor Summary

Constructors
Constructor and Description
`CloudSpannerDataSource()`

### Method Summary

All Methods Instance Methods Concrete Methods
`Connection` `getConnection()`
`Connection` `getConnection(String username, String password)` This method will just call `getConnection()` as a username and password is not needed for a connection.
`String` `getDatabase()`
`String` `getHost()`
`String` `getInstanceId()`
`int` `getLoginTimeout()`
`PrintWriter` `getLogWriter()`
`String` `getOauthAccessToken()`
`Logger` `getParentLogger()`
`String` `getProjectId()`
`String` `getPvtKeyPath()`
`String` `getSimulateProductName()`
`boolean` `isAllowExtendedMode()`
`boolean` `isUseCustomHost()`
`void` `setAllowExtendedMode(boolean allowExtendedMode)`
`void` `setDatabase(String database)`
`void` `setHost(String host)` Sets the host to use for this `DataSource`.
`void` `setInstanceId(String instanceId)`
`void` `setLoginTimeout(int seconds)`
`void` `setLogWriter(PrintWriter out)`
`void` `setOauthAccessToken(String oauthAccessToken)`
`void` `setProjectId(String projectId)`
`void` `setPvtKeyPath(String pvtKeyPath)`
`void` `setSimulateProductName(String simulateProductName)`
`void` `setUseCustomHost(boolean useCustomHost)`

### Methods inherited from class nl.topicus.jdbc.metadata.AbstractCloudSpannerWrapper

`extractColumnType, getClassName, getClassName, getGoogleTypeName, isWrapperFor, unwrap`

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

#### CloudSpannerDataSource

    public CloudSpannerDataSource()

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

This method will just call `getConnection()` as a username and password is not needed for a connection. Instead you need to supply a key file.

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

#### getHost

    public String getHost()

#### setHost

    public void setHost(String host)

Sets the host to use for this `DataSource`. Setting this property also automatically sets the property UseCustomHost to true.

Parameters:
  `host` - The host to use

#### getProjectId

    public String getProjectId()

#### setProjectId

    public void setProjectId(String projectId)

#### getInstanceId

    public String getInstanceId()

#### setInstanceId

    public void setInstanceId(String instanceId)

#### getDatabase

    public String getDatabase()

#### setDatabase

    public void setDatabase(String database)

#### getPvtKeyPath

    public String getPvtKeyPath()

#### setPvtKeyPath

    public void setPvtKeyPath(String pvtKeyPath)

#### getOauthAccessToken

    public String getOauthAccessToken()

#### setOauthAccessToken

    public void setOauthAccessToken(String oauthAccessToken)

#### getSimulateProductName

    public String getSimulateProductName()

#### setSimulateProductName

    public void setSimulateProductName(String simulateProductName)

#### isAllowExtendedMode

    public boolean isAllowExtendedMode()

#### setAllowExtendedMode

    public void setAllowExtendedMode(boolean allowExtendedMode)

#### isUseCustomHost

    public boolean isUseCustomHost()

#### setUseCustomHost

    public void setUseCustomHost(boolean useCustomHost)