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