com.taosdata.jdbc

## Class TSDBDriver

- java.lang.Object
- - com.taosdata.jdbc.AbstractDriver
  - - com.taosdata.jdbc.TSDBDriver

All Implemented Interfaces:
  Driver

    public class TSDBDriver
    extends AbstractDriver

The Java SQL framework allows for multiple database drivers. Each driver should supply a class that implements the Driver interface

The DriverManager will try to load as many drivers as it can find and then for any given connection request, it will ask each driver in turn to try to connect to the target URL.

It is strongly recommended that each Driver class should be small and stand alone so that the Driver class can be loaded and queried without bringing in vast quantities of supporting code.

When a Driver class is loaded, it should create an instance of itself and register it with the DriverManager. This means that a user can load and register a driver by doing Class.forName("foo.bah.Driver")

### Field Summary

Fields
`static String` `HTTP_CONNECT_TIMEOUT` the timeout in milliseconds until a connection is established.
`static String` `HTTP_KEEP_ALIVE`
`static String` `HTTP_POOL_SIZE` max pool size
`static String` `HTTP_SOCKET_TIMEOUT` Defines the socket timeout in milliseconds, which is the timeout for waiting for data or, put differently, a maximum period inactivity between two consecutive data packets.
`static String` `PROPERTY_KEY_APP_IP`
`static String` `PROPERTY_KEY_APP_NAME`
`static String` `PROPERTY_KEY_ASYNC_WRITE`
`static String` `PROPERTY_KEY_BACKEND_WRITE_THREAD_NUM`
`static String` `PROPERTY_KEY_BATCH_ERROR_IGNORE` continue process commands in executeBatch
`static String` `PROPERTY_KEY_BATCH_LOAD` fetch data from native function in a batch model
`static String` `PROPERTY_KEY_BATCH_SIZE_BY_ROW`
`static String` `PROPERTY_KEY_BEARER_TOKEN` Key used to retrieve the bearer_token value from the properties instance passed to the driver.
`static String` `PROPERTY_KEY_CACHE_SIZE_BY_ROW`
`static String` `PROPERTY_KEY_CHARSET` Key for the char encoding used by the TSDB client in properties instance
`static String` `PROPERTY_KEY_CONFIG_DIR` Key for the configuration file directory of TSDB client in properties instance
`static String` `PROPERTY_KEY_CONNECT_MODE` connect mode
`static String` `PROPERTY_KEY_COPY_DATA` for efficient writing
`static String` `PROPERTY_KEY_DBNAME` Key used to retrieve the database value from the properties instance passed to the driver.
`static String` `PROPERTY_KEY_DISABLE_SSL_CERT_VALIDATION`
`static String` `PROPERTY_KEY_ENABLE_AUTO_RECONNECT`
`static String` `PROPERTY_KEY_ENABLE_COMPRESSION`
`static String` `PROPERTY_KEY_ENDPOINTS` Key used to retrieve the endpoints value from the properties instance passed to the driver.
`static String` `PROPERTY_KEY_HEALTH_CHECK_CMD_TIMEOUT`
`static String` `PROPERTY_KEY_HEALTH_CHECK_CON_TIMEOUT`
`static String` `PROPERTY_KEY_HEALTH_CHECK_INIT_INTERVAL` for health check
`static String` `PROPERTY_KEY_HEALTH_CHECK_MAX_INTERVAL`
`static String` `PROPERTY_KEY_HEALTH_CHECK_RECOVERY_COUNT`
`static String` `PROPERTY_KEY_HEALTH_CHECK_RECOVERY_INTERVAL`
`static String` `PROPERTY_KEY_HOST` Key used to retrieve the host value from the properties instance passed to the driver.
`static String` `PROPERTY_KEY_LOCALE` Key for the locale used by the TSDB client in properties instance
`static String` `PROPERTY_KEY_MAX_CONCURRENT_REQUEST` max message number send to server concurrently
`static String` `PROPERTY_KEY_MESSAGE_WAIT_TIMEOUT` message receive from server timeout.
`static String` `PROPERTY_KEY_PASSWORD` Key used to retrieve the password value from the properties instance passed to the driver.
`static String` `PROPERTY_KEY_PBS_MODE` for stmt bind mode
`static String` `PROPERTY_KEY_PORT` Key used to retrieve the port number value from the properties instance passed to the driver.
`static String` `PROPERTY_KEY_PRODUCT_NAME` PRODUCT_NAME
`static String` `PROPERTY_KEY_REBALANCE_CON_BASE_COUNT`
`static String` `PROPERTY_KEY_REBALANCE_THRESHOLD`
`static String` `PROPERTY_KEY_RECONNECT_INTERVAL_MS`
`static String` `PROPERTY_KEY_RECONNECT_RETRY_COUNT`
`static String` `PROPERTY_KEY_RETRY_TIMES`
`static String` `PROPERTY_KEY_SLAVE_CLUSTER_HOST`
`static String` `PROPERTY_KEY_SLAVE_CLUSTER_PORT`
`static String` `PROPERTY_KEY_STRICT_CHECK`
`static String` `PROPERTY_KEY_TIME_ZONE` Key for the timezone used by the TSDB client in properties instance
`static String` `PROPERTY_KEY_TOKEN` Key used to retrieve the token value from the properties instance passed to the driver.
`static String` `PROPERTY_KEY_USE_SSL` Use SSL (true/false) to communicate with the server.
`static String` `PROPERTY_KEY_USER` Key used to retrieve the user value from the properties instance passed to the driver.
`static String` `PROPERTY_KEY_VARCHAR_AS_STRING` Specifies whether to treat VARCHAR as STRING type.
`static String` `PROPERTY_KEY_WS_KEEP_ALIVE_SECONDS`
`static String` `URL_PREFIX`

### Constructor Summary

Constructors
Constructor and Description
`TSDBDriver()`

### Method Summary

All Methods Instance Methods Concrete Methods
`boolean` `acceptsURL(String url)`
`Connection` `connect(String url, Properties info)`
`int` `getMajorVersion()`
`int` `getMinorVersion()`
`Logger` `getParentLogger()`
`DriverPropertyInfo[]` `getPropertyInfo(String url, Properties info)`
`boolean` `jdbcCompliant()`
`Properties` `parseURL(String url, Properties defaults)` example: jdbc:TAOS://127.0.0.1:0/db?user=user_abc&password=your_password

### Methods inherited from class com.taosdata.jdbc.AbstractDriver

`getPropertyInfo, getWSConnection`

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

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

### Field Detail

#### URL_PREFIX

    public static final String URL_PREFIX

See Also:
  Constant Field Values

#### PROPERTY_KEY_PRODUCT_NAME

    public static final String PROPERTY_KEY_PRODUCT_NAME

PRODUCT_NAME

See Also:
  Constant Field Values

#### PROPERTY_KEY_HOST

    public static final String PROPERTY_KEY_HOST

Key used to retrieve the host value from the properties instance passed to the driver.

See Also:
  Constant Field Values

#### PROPERTY_KEY_PORT

    public static final String PROPERTY_KEY_PORT

Key used to retrieve the port number value from the properties instance passed to the driver.

See Also:
  Constant Field Values

#### PROPERTY_KEY_ENDPOINTS

    public static final String PROPERTY_KEY_ENDPOINTS

Key used to retrieve the endpoints value from the properties instance passed to the driver.

See Also:
  Constant Field Values

#### PROPERTY_KEY_DBNAME

    public static final String PROPERTY_KEY_DBNAME

Key used to retrieve the database value from the properties instance passed to the driver.

See Also:
  Constant Field Values

#### PROPERTY_KEY_USER

    public static final String PROPERTY_KEY_USER

Key used to retrieve the user value from the properties instance passed to the driver.

See Also:
  Constant Field Values

#### PROPERTY_KEY_PASSWORD

    public static final String PROPERTY_KEY_PASSWORD

Key used to retrieve the password value from the properties instance passed to the driver.

See Also:
  Constant Field Values

#### PROPERTY_KEY_BEARER_TOKEN

    public static final String PROPERTY_KEY_BEARER_TOKEN

Key used to retrieve the bearer_token value from the properties instance passed to the driver.

See Also:
  Constant Field Values

#### PROPERTY_KEY_TOKEN

    public static final String PROPERTY_KEY_TOKEN

Key used to retrieve the token value from the properties instance passed to the driver. Just for Cloud Service

See Also:
  Constant Field Values

#### PROPERTY_KEY_USE_SSL

    public static final String PROPERTY_KEY_USE_SSL

Use SSL (true/false) to communicate with the server. The default value is false. Just for Cloud Service

See Also:
  Constant Field Values

#### PROPERTY_KEY_CONFIG_DIR

    public static final String PROPERTY_KEY_CONFIG_DIR

Key for the configuration file directory of TSDB client in properties instance

See Also:
  Constant Field Values

#### PROPERTY_KEY_TIME_ZONE

    public static final String PROPERTY_KEY_TIME_ZONE

Key for the timezone used by the TSDB client in properties instance

See Also:
  Constant Field Values

#### PROPERTY_KEY_LOCALE

    public static final String PROPERTY_KEY_LOCALE

Key for the locale used by the TSDB client in properties instance

See Also:
  Constant Field Values

#### PROPERTY_KEY_CHARSET

    public static final String PROPERTY_KEY_CHARSET

Key for the char encoding used by the TSDB client in properties instance

See Also:
  Constant Field Values

#### PROPERTY_KEY_BATCH_LOAD

    public static final String PROPERTY_KEY_BATCH_LOAD

fetch data from native function in a batch model

See Also:
  Constant Field Values

#### PROPERTY_KEY_BATCH_ERROR_IGNORE

    public static final String PROPERTY_KEY_BATCH_ERROR_IGNORE

continue process commands in executeBatch

See Also:
  Constant Field Values

#### PROPERTY_KEY_MESSAGE_WAIT_TIMEOUT

    public static final String PROPERTY_KEY_MESSAGE_WAIT_TIMEOUT

message receive from server timeout. ms

See Also:
  Constant Field Values

#### PROPERTY_KEY_WS_KEEP_ALIVE_SECONDS

    public static final String PROPERTY_KEY_WS_KEEP_ALIVE_SECONDS

See Also:
  Constant Field Values

#### PROPERTY_KEY_CONNECT_MODE

    public static final String PROPERTY_KEY_CONNECT_MODE

connect mode

See Also:
  Constant Field Values

#### PROPERTY_KEY_VARCHAR_AS_STRING

    public static final String PROPERTY_KEY_VARCHAR_AS_STRING

Specifies whether to treat VARCHAR as STRING type. Only effected in WebSocket connection mode. This property can be used to control how VARCHAR data is handled.

See Also:
  Constant Field Values

#### PROPERTY_KEY_ENABLE_COMPRESSION

    public static final String PROPERTY_KEY_ENABLE_COMPRESSION

See Also:
  Constant Field Values

#### PROPERTY_KEY_ENABLE_AUTO_RECONNECT

    public static final String PROPERTY_KEY_ENABLE_AUTO_RECONNECT

See Also:
  Constant Field Values

#### PROPERTY_KEY_SLAVE_CLUSTER_HOST

    public static final String PROPERTY_KEY_SLAVE_CLUSTER_HOST

See Also:
  Constant Field Values

#### PROPERTY_KEY_SLAVE_CLUSTER_PORT

    public static final String PROPERTY_KEY_SLAVE_CLUSTER_PORT

See Also:
  Constant Field Values

#### PROPERTY_KEY_RECONNECT_INTERVAL_MS

    public static final String PROPERTY_KEY_RECONNECT_INTERVAL_MS

See Also:
  Constant Field Values

#### PROPERTY_KEY_RECONNECT_RETRY_COUNT

    public static final String PROPERTY_KEY_RECONNECT_RETRY_COUNT

See Also:
  Constant Field Values

#### PROPERTY_KEY_DISABLE_SSL_CERT_VALIDATION

    public static final String PROPERTY_KEY_DISABLE_SSL_CERT_VALIDATION

See Also:
  Constant Field Values

#### PROPERTY_KEY_APP_IP

    public static final String PROPERTY_KEY_APP_IP

See Also:
  Constant Field Values

#### PROPERTY_KEY_APP_NAME

    public static final String PROPERTY_KEY_APP_NAME

See Also:
  Constant Field Values

#### PROPERTY_KEY_COPY_DATA

    public static final String PROPERTY_KEY_COPY_DATA

for efficient writing

See Also:
  Constant Field Values

#### PROPERTY_KEY_BATCH_SIZE_BY_ROW

    public static final String PROPERTY_KEY_BATCH_SIZE_BY_ROW

See Also:
  Constant Field Values

#### PROPERTY_KEY_CACHE_SIZE_BY_ROW

    public static final String PROPERTY_KEY_CACHE_SIZE_BY_ROW

See Also:
  Constant Field Values

#### PROPERTY_KEY_BACKEND_WRITE_THREAD_NUM

    public static final String PROPERTY_KEY_BACKEND_WRITE_THREAD_NUM

See Also:
  Constant Field Values

#### PROPERTY_KEY_STRICT_CHECK

    public static final String PROPERTY_KEY_STRICT_CHECK

See Also:
  Constant Field Values

#### PROPERTY_KEY_RETRY_TIMES

    public static final String PROPERTY_KEY_RETRY_TIMES

See Also:
  Constant Field Values

#### PROPERTY_KEY_ASYNC_WRITE

    public static final String PROPERTY_KEY_ASYNC_WRITE

See Also:
  Constant Field Values

#### PROPERTY_KEY_HEALTH_CHECK_INIT_INTERVAL

    public static final String PROPERTY_KEY_HEALTH_CHECK_INIT_INTERVAL

for health check

See Also:
  Constant Field Values

#### PROPERTY_KEY_HEALTH_CHECK_MAX_INTERVAL

    public static final String PROPERTY_KEY_HEALTH_CHECK_MAX_INTERVAL

See Also:
  Constant Field Values

#### PROPERTY_KEY_HEALTH_CHECK_CON_TIMEOUT

    public static final String PROPERTY_KEY_HEALTH_CHECK_CON_TIMEOUT

See Also:
  Constant Field Values

#### PROPERTY_KEY_HEALTH_CHECK_CMD_TIMEOUT

    public static final String PROPERTY_KEY_HEALTH_CHECK_CMD_TIMEOUT

See Also:
  Constant Field Values

#### PROPERTY_KEY_HEALTH_CHECK_RECOVERY_COUNT

    public static final String PROPERTY_KEY_HEALTH_CHECK_RECOVERY_COUNT

See Also:
  Constant Field Values

#### PROPERTY_KEY_HEALTH_CHECK_RECOVERY_INTERVAL

    public static final String PROPERTY_KEY_HEALTH_CHECK_RECOVERY_INTERVAL

See Also:
  Constant Field Values

#### PROPERTY_KEY_REBALANCE_THRESHOLD

    public static final String PROPERTY_KEY_REBALANCE_THRESHOLD

See Also:
  Constant Field Values

#### PROPERTY_KEY_REBALANCE_CON_BASE_COUNT

    public static final String PROPERTY_KEY_REBALANCE_CON_BASE_COUNT

See Also:
  Constant Field Values

#### PROPERTY_KEY_PBS_MODE

    public static final String PROPERTY_KEY_PBS_MODE

for stmt bind mode

See Also:
  Constant Field Values

#### PROPERTY_KEY_MAX_CONCURRENT_REQUEST

    public static final String PROPERTY_KEY_MAX_CONCURRENT_REQUEST

max message number send to server concurrently

See Also:
  Constant Field Values

#### HTTP_POOL_SIZE

    public static final String HTTP_POOL_SIZE

max pool size

See Also:
  Constant Field Values

#### HTTP_KEEP_ALIVE

    public static final String HTTP_KEEP_ALIVE

See Also:
  Constant Field Values

#### HTTP_CONNECT_TIMEOUT

    public static final String HTTP_CONNECT_TIMEOUT

the timeout in milliseconds until a connection is established. zero is interpreted as an infinite timeout.

See Also:
  Constant Field Values

#### HTTP_SOCKET_TIMEOUT

    public static final String HTTP_SOCKET_TIMEOUT

Defines the socket timeout in milliseconds, which is the timeout for waiting for data or, put differently, a maximum period inactivity between two consecutive data packets. zero is interpreted as an infinite timeout.

See Also:
  Constant Field Values

### Constructor Detail

#### TSDBDriver

    public TSDBDriver()

### Method Detail

#### connect

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

Throws:
  `SQLException`

#### acceptsURL

    public boolean acceptsURL(String url)
                       throws SQLException

Parameters:
  `url` - the URL of the database
Returns:
  `true` if this driver understands the given URL; `false` otherwise
Throws:
  `SQLException` - if a database access error occurs or the url is `null`

#### getPropertyInfo

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

Throws:
  `SQLException`

#### parseURL

    public Properties parseURL(String url,
                               Properties defaults)
                        throws SQLException

example: jdbc:TAOS://127.0.0.1:0/db?user=user_abc&password=your_password

Throws:
  `SQLException`

#### getMajorVersion

    public int getMajorVersion()

#### getMinorVersion

    public int getMinorVersion()

#### jdbcCompliant

    public boolean jdbcCompliant()

#### getParentLogger

    public Logger getParentLogger()