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
DataSourceimplementation for Google Cloud Spanner.
-
-
Constructor Summary
Constructors Constructor Description JdbcDataSource()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BooleangetAutocommit()ConnectiongetConnection()ConnectiongetConnection(String username, String password)StringgetCredentials()intgetLoginTimeout()PrintWritergetLogWriter()LoggergetParentLogger()BooleangetReadonly()BooleangetRetryAbortsInternally()StringgetUrl()booleanisClosed()Should return true if this object has been closedbooleanisWrapperFor(Class<?> iface)voidsetAutocommit(Boolean autocommit)voidsetCredentials(String credentials)voidsetLoginTimeout(int seconds)voidsetLogWriter(PrintWriter out)voidsetReadonly(Boolean readonly)voidsetRetryAbortsInternally(Boolean retryAbortsInternally)voidsetUrl(String url)<T> Tunwrap(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
-
-
-
-
Method Detail
-
getLogWriter
public PrintWriter getLogWriter()
- Specified by:
getLogWriterin interfaceCommonDataSource
-
setLogWriter
public void setLogWriter(PrintWriter out)
- Specified by:
setLogWriterin interfaceCommonDataSource
-
setLoginTimeout
public void setLoginTimeout(int seconds)
- Specified by:
setLoginTimeoutin interfaceCommonDataSource
-
getLoginTimeout
public int getLoginTimeout()
- Specified by:
getLoginTimeoutin interfaceCommonDataSource
-
getParentLogger
public Logger getParentLogger() throws SQLFeatureNotSupportedException
- Specified by:
getParentLoggerin interfaceCommonDataSource- Throws:
SQLFeatureNotSupportedException
-
getConnection
public Connection getConnection() throws SQLException
- Specified by:
getConnectionin interfaceDataSource- Throws:
SQLException
-
getConnection
public Connection getConnection(String username, String password) throws SQLException
- Specified by:
getConnectionin interfaceDataSource- 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 thisDataSource.
-
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 thisDataSource. 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 thisDataSource. 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 thisDataSource. 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 thisDataSource. 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:
isWrapperForin interfaceWrapper
-
unwrap
public <T> T unwrap(Class<T> iface) throws SQLException
- Specified by:
unwrapin interfaceWrapper- Throws:
SQLException
-
-