Class JdbcDataSource (2.21.0)

public class JdbcDataSource extends AbstractJdbcWrapper implements DataSource

DataSource implementation for Google Cloud Spanner.

Inheritance

java.lang.Object > com.google.cloud.spanner.jdbc.AbstractJdbcWrapper > JdbcDataSource

Implements

DataSource

Constructors

JdbcDataSource()

public JdbcDataSource()

Methods

getAutocommit()

public Boolean getAutocommit()
Returns
Type Description
Boolean

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.

getConnection()

public Connection getConnection()
Returns
Type Description
Connection
Exceptions
Type Description
SQLException

getConnection(String username, String password)

public Connection getConnection(String username, String password)
Parameters
Name Description
username String
password String
Returns
Type Description
Connection
Exceptions
Type Description
SQLException

getCredentials()

public String getCredentials()
Returns
Type Description
String

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.

getLogWriter()

public PrintWriter getLogWriter()
Returns
Type Description
PrintWriter

getLoginTimeout()

public int getLoginTimeout()
Returns
Type Description
int

getParentLogger()

public Logger getParentLogger()
Returns
Type Description
Logger
Exceptions
Type Description
SQLFeatureNotSupportedException

getReadonly()

public Boolean getReadonly()
Returns
Type Description
Boolean

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
Type Description
Boolean

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.

getUrl()

public String getUrl()
Returns
Type Description
String

the JDBC URL to use for this DataSource.

isClosed()

public boolean isClosed()

Should return true if this object has been closed

Returns
Type Description
boolean
Overrides
com.google.cloud.spanner.jdbc.AbstractJdbcWrapper.isClosed()

setAutocommit(Boolean autocommit)

public void setAutocommit(Boolean autocommit)
Parameter
Name Description
autocommit Boolean

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.

setCredentials(String credentials)

public void setCredentials(String credentials)
Parameter
Name Description
credentials String

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.

setLogWriter(PrintWriter out)

public void setLogWriter(PrintWriter out)
Parameter
Name Description
out PrintWriter

setLoginTimeout(int seconds)

public void setLoginTimeout(int seconds)
Parameter
Name Description
seconds int

setReadonly(Boolean readonly)

public void setReadonly(Boolean readonly)
Parameter
Name Description
readonly Boolean

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.

setRetryAbortsInternally(Boolean retryAbortsInternally)

public void setRetryAbortsInternally(Boolean retryAbortsInternally)
Parameter
Name Description
retryAbortsInternally Boolean

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.

setUrl(String url)

public void setUrl(String url)
Parameter
Name Description
url String

The JDBC URL to use for this DataSource.