nl.topicus.jdbc

## Class CloudSpannerDriver

- java.lang.Object
- - nl.topicus.jdbc.CloudSpannerDriver

All Implemented Interfaces:
  Driver

    public class CloudSpannerDriver
    extends Object
    implements Driver

### Field Summary

Fields
`static int` `DEBUG`
`static int` `INFO`
`static int` `OFF`

### Constructor Summary

Constructors
Constructor and Description
`CloudSpannerDriver()`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`boolean` `acceptsURL(String url)`
`CloudSpannerConnection` `connect(String url, Properties info)` Connects to a Google Cloud Spanner database.
`static void` `deregister()` According to JDBC specification, this driver is registered against `DriverManager` when the class is loaded.
`static int` `getDriverMajorVersion()`
`static int` `getDriverMinorVersion()`
`static int` `getLogLevel()`
`int` `getMajorVersion()`
`int` `getMinorVersion()`
`Logger` `getParentLogger()`
`DriverPropertyInfo[]` `getPropertyInfo(String url, Properties info)`
`static String` `getVersion()`
`static boolean` `isRegistered()`
`boolean` `jdbcCompliant()`
`static String` `quoteIdentifier(String identifier)`
`static void` `register()` Register the driver against `DriverManager`.
`static void` `setLogLevel(int logLevel)`
`static String` `unquoteIdentifier(String identifier)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### DEBUG

    public static final int DEBUG

See Also:
  Constant Field Values

#### INFO

    public static final int INFO

See Also:
  Constant Field Values

#### OFF

    public static final int OFF

See Also:
  Constant Field Values

### Constructor Detail

#### CloudSpannerDriver

    public CloudSpannerDriver()

### Method Detail

#### connect

    public CloudSpannerConnection connect(String url,
                                          Properties info)
                                   throws SQLException

Connects to a Google Cloud Spanner database.

Specified by:
  `connect` in interface `Driver`
Parameters:
  `url` - Connection URL in the form jdbc:cloudspanner://localhost;Project =projectId;Instance=instanceId ;Database=databaseName;PvtKeyPath =path_to_key_file;SimulateProductName=product_name
  `info` - Additional connection properties that will be set on the new connection
Returns:
  An open `CloudSpannerConnection`
Throws:
  `SQLException` - if an error occurs while connecting to Google Cloud Spanner

#### acceptsURL

    public boolean acceptsURL(String url)
                       throws SQLException

Specified by:
  `acceptsURL` in interface `Driver`
Throws:
  `SQLException`

#### getPropertyInfo

    public DriverPropertyInfo[] getPropertyInfo(String url,
                                                Properties info)
                                         throws SQLException

Specified by:
  `getPropertyInfo` in interface `Driver`
Throws:
  `SQLException`

#### getMajorVersion

    public int getMajorVersion()

Specified by:
  `getMajorVersion` in interface `Driver`

#### getDriverMajorVersion

    public static int getDriverMajorVersion()

#### getMinorVersion

    public int getMinorVersion()

Specified by:
  `getMinorVersion` in interface `Driver`

#### getDriverMinorVersion

    public static int getDriverMinorVersion()

#### getVersion

    public static String getVersion()

#### jdbcCompliant

    public boolean jdbcCompliant()

Specified by:
  `jdbcCompliant` in interface `Driver`

#### getParentLogger

    public Logger getParentLogger()
                           throws SQLFeatureNotSupportedException

Specified by:
  `getParentLogger` in interface `Driver`
Throws:
  `SQLFeatureNotSupportedException`

#### quoteIdentifier

    public static String quoteIdentifier(String identifier)

#### unquoteIdentifier

    public static String unquoteIdentifier(String identifier)

#### setLogLevel

    public static void setLogLevel(int logLevel)

#### getLogLevel

    public static int getLogLevel()

#### register

    public static void register()
                         throws SQLException

Register the driver against `DriverManager`. This is done automatically when the class is loaded. Dropping the driver from DriverManager's list is possible using `deregister()` method.

Throws:
  `IllegalStateException` - if the driver is already registered
  `SQLException` - if registering the driver fails

#### deregister

    public static void deregister()
                           throws SQLException

According to JDBC specification, this driver is registered against `DriverManager` when the class is loaded. To avoid leaks, this method allow unregistering the driver so that the class can be gc'ed if necessary.

Throws:
  `IllegalStateException` - if the driver is not registered
  `SQLException` - if deregistering the driver fails

#### isRegistered

    public static boolean isRegistered()

Returns:
  `true` if the driver is registered against `DriverManager`