# The SingleStore JDBC Driver

The SingleStore JDBC Driver can be used to connect your SingleStore databases to Java-based applications, like BI and ETL tools. It is a Type 4 JDBC 4.2 compatible driver licensed under GNU LGPL.

## Driver Compatibility

The SingleStore JDBC Driver is compatible with:

* Java 21, Java 17, Java 11, and Java 8
* JDBC 4.2
* SingleStore v7.5+. Refer to the following compatibility matrix for information on SingleStore database version supported for each SingleStore JDBC driver version.

* *SingleStore JDBC Driver Version Compatibility Matrix*

  The following compatibility matrix shows the SingleStore database version supported for each SingleStore JDBC driver version:| JDBC Driver Version | SupportedSingleStoreDatabase Version |      |      |      |      |      |      |      |      |
  | ------------------- | ------------------------------------ | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- |
  |                     | v7.6                                 | v7.8 | v8.0 | v8.1 | v8.5 | v8.7 | v8.9 | v9.0 | v9.1 |
  | 1.2.10              |                                      |      |      |      |      | ✔    | ✔    | ✔    | ✔    |
  | 1.2.8               |                                      |      |      |      | ✔    | ✔    | ✔    |      |      |
  | 1.2.7               |                                      |      |      | ✔    | ✔    | ✔    | ✔    |      |      |
  | 1.2.6               |                                      |      | ✔    | ✔    | ✔    | ✔    |      |      |      |
  | 1.2.5               |                                      |      | ✔    | ✔    | ✔    | ✔    |      |      |      |
  | 1.2.4               |                                      |      | ✔    | ✔    | ✔    |      |      |      |      |
  | 1.2.3               |                                      | ✔    | ✔    | ✔    | ✔    |      |      |      |      |
  | 1.2.2               |                                      | ✔    | ✔    | ✔    | ✔    |      |      |      |      |
  | 1.2.1               |                                      | ✔    | ✔    | ✔    |      |      |      |      |      |
  | 1.2.0               | ✔                                    | ✔    | ✔    | ✔    |      |      |      |      |      |
  | 1.1.9               | ✔                                    | ✔    | ✔    | ✔    |      |      |      |      |      |
  | 1.1.8               | ✔                                    | ✔    | ✔    | ✔    |      |      |      |      |      |
  | 1.1.7               | ✔                                    | ✔    | ✔    |      |      |      |      |      |      |
  | 1.1.6               | ✔                                    | ✔    | ✔    |      |      |      |      |      |      |
  | 1.1.5               | ✔                                    | ✔    | ✔    |      |      |      |      |      |      |
  | 1.1.4               | ✔                                    | ✔    |      |      |      |      |      |      |      |
  | 1.1.3               | ✔                                    | ✔    |      |      |      |      |      |      |      |
  | 1.1.2               | ✔                                    | ✔    |      |      |      |      |      |      |      |
  | 1.1.1               | ✔                                    | ✔    |      |      |      |      |      |      |      |
  | 1.1.0               | ✔                                    | ✔    |      |      |      |      |      |      |      |
  | 1.0.2               | ✔                                    |      |      |      |      |      |      |      |      |
  | 1.0.1               | ✔                                    |      |      |      |      |      |      |      |      |
  | 0.1.0               | ✔                                    |      |      |      |      |      |      |      |      |

## Prerequisites

To build the SingleStore JDBC Driver from source, you'll need:

* [Maven](https://maven.apache.org/download.cgi)
* Java JDK

> **📝 Note**: Maven is not an absolute requirement for using the driver with other applications.

## Download and Install the SingleStore JDBC Driver

You can install the SingleStore JDBC Driver with any of the following methods.

> **📝 Note**: To find the latest version of the driver, refer to [SingleStore JDBC Driver Releases](https://github.com/memsql/S2-JDBC-Connector/releases) on GitHub.

**Install with Maven**

Include the following dependency in your `pom.xml` file, to install the driver using Maven. Be sure to replace the value in `<version></version>` with the version you want to use:

```xml
<dependency>
	<groupId>com.singlestore</groupId>
	<artifactId>singlestore-jdbc-client</artifactId>
	<version>x.x.x</version>
</dependency>
```

**Install without Maven**

If your project does not use Maven, you can download the `.jar` from [GitHub](https://github.com/memsql/S2-JDBC-Connector/releases) or [Maven Repository](https://mvnrepository.com/artifact/com.singlestore/singlestore-jdbc-client) and include it in your project (install in your `CLASSPATH`) to use it.

**Build from Source**

To build the SingleStore JDBC Driver from source, follow these steps:

1. Clone the [S2-JDBC-Connector](https://github.com/memsql/S2-JDBC-Connector) repository using the following command:
   ```shell
   git clone https://github.com/memsql/S2-JDBC-Connector.git
   ```

2. Execute the following command from the root of the repository:
   ```shell
   mvn -Dmaven.test.skip -Dmaven.javadoc.skip package
   ```
   This command generates a `singlestore-jdbc-client-<version>.jar` file in the `target` subdirectory. Install this file in a directory in your JAVA `CLASSPATH` to use the driver.

## Use the SingleStore JDBC Driver

There are two methods to connect using the SingleStore JDBC Driver: using the [DriverManager](https://docs.oracle.com/javase/8/docs/api/java/sql/DriverManager.html) class or using a connection pool. You will also need a connection string to get a connection.

> **📝 Note**: To use the SingleStore JDBC Driver in external applications, specify the JDBC Driver Class as `com.singlestore.jdbc.Driver`.

## Connection String Format

The connection string must have the following format:

```jdbc
jdbc:singlestore:[loadbalance:|sequential:]//<hostDescription>[,<hostDescription>...]/[database][?<key1>=<value1>[&<key2>=<value2>]]

hostDescription:
    <host>[:port] | address=(host=<host>)[(port=<port>)][(type=(master|slave))]

```

* The default for port is `3306`. The default host type is `master`.
* The host must be an IP address or DNS name. If the host is an IPv6 address, then it must be enclosed within square brackets.

See [Connection String Parameters](https://docs.singlestore.com/#section-idm4492642533297632740896869469.md) for more information. Here's a sample connection string:

```jdbc
"jdbc:singlestore://localhost:3306/test?user=root&password=myPassword"
```

## Connect using the `DriverManager` Class

The [DriverManager](https://docs.oracle.com/javase/8/docs/api/java/sql/DriverManager.html) class automatically configures the application and loads the SingleStore JDBC Driver. Here is some sample code that uses the `DriverManager` class:

```java
Connection connection = DriverManager.getConnection("jdbc:singlestore://localhost:3306/test?user=root&password=myPassword");
Statement stmt = connection.createStatement();

ResultSet rs = stmt.executeQuery("SELECT NOW()");
rs.next();
System.out.println(rs.getTimestamp(1));
```

## Connect using the Connection Pool

You can also get a connection with SingleStore JDBC Driver via a connection pool. There are two DataSource implementations that you may choose from to use a connection pool.

* The `SingleStoreDataSource` is a basic implementation that returns a new connection each time the `getConnection()` method is called.
* The `SingleStorePoolDataSource` is a connection pool implementation that maintains a pool of connections. A connection is borrowed from the pool each time a new connection is requested.

## Failover and Load-Balancing Modes

The SingleStore JDBC Driver supports the following failover/load-balancing modes:

| Mode          | Description                                                                                                                                                                                                                           |
| ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `sequential`  | In this mode, the driver tries to connect with the hosts in the order in which they are declared in the connection string. Hence, the first available host is used for all the queries.                                               |
| `loadbalance` | The driver randomly selects a host from the connection string, for each connection, to perform load-balancing on all the queries. Hence, the queries are load-balanced by randomly distributing the connections across all the hosts. |

## Fetch Size Behavior

By default, the SingleStore JDBC driver loads the entire result set into the client JVM after a query completes. While this behavior simplifies application configuration, it can result in high memory usage when a query returns very large result sets.

Use the `defaultFetchSize` connection parameter to stream the result set in batches and limit the number of rows stored in the memory. When a `defaultFetchSize` greater than `0` is specified for a connection, it calls the `Statement.setFetchSize(n)` method to configure the fetch size to the specified number of rows for all the statements created from this connection.

The `defaultFetchSize` parameter only supports integer values greater than or equal to `0`.

| `defaultFetchSize`Value | Behavior                                                     |
| ----------------------- | ------------------------------------------------------------ |
| 0                       | Fetch and store the entire result set.                       |
| > 0 (Positive integer)  | Fetch and store the result set in batches of specified size. |

Alternatively, to configure the fetch size for a specific statement, use the `Statement.setFetchSize(n)` method as:

```java
Statement stmt = connection.createStatement(...);

stmt.setFetchSize(500);
ResultSet rs = stmt.executeQuery("...");
```

For example, if `defaultFetchSize` is set to 1000, the driver loads the first 1000 rows into memory. Once the application iterates through the first batch of 1000 rows and calls `ResultSet.next()`, the driver fetches and stores the next 1000 rows. This process repeats until all the rows are retrieved.

> **📝 Note**: Even if a fetch size is specified, the server still sends all the rows; the fetch size only controls how many rows the client retrieves and stores at a time.

If another query is run on the same connection before the result set is completely read, the driver fetches all the remaining rows of the current query to run the new query. If not properly handled, this can result in high memory usage or out-of-memory errors. SingleStore recommends using different connections for concurrent operations that may return large result sets.

## Connection String Parameters

The SingleStore JDBC Driver supports the following parameters in the connection string.

## Essential Parameters

| Parameter            | Description                                                                                                                                                                                                                                                                                                                                                             | Default Value | Supported Driver Version |
| -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- | ------------------------ |
| `user`               | Username for the database.                                                                                                                                                                                                                                                                                                                                              |               | 1.0.0+                   |
| `password`           | The password of the database user.                                                                                                                                                                                                                                                                                                                                      |               | 1.0.0+                   |
| `connectTimeout`     | The connection timeout value (in*ms*). Upon timeout, attempts to establish a connection to the database are aborted.Set to`0`to disable connection timeout.                                                                                                                                                                                                             | 30000         | 1.0.0+                   |
| `useServerPrepStmts` | Enables using PrepareStatements. PrepareStatements are pre-compiled on the server-side before executing. Applications that use the same queries repeatedly can enable this option. In general, it's preferable to leave this parameter as FALSE, becauseSingleStorehas wider support of queries in text protocol and has internal mechanisms of query parameterization. | `FALSE`       | 1.0.0+                   |
| `allowLocalInfile`   | Allows users to load data from the local filesystem. See[LOAD DATA](https://docs.singlestore.com/db/v9.1/reference/sql-reference/data-manipulation-language-dml/load-data.md)for more information on loading data intoSingleStore.                                                                                                                                      | `FALSE`       | 1.0.0+                   |

## TLS Parameters

| Parameter                        | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | Default Value | Supported Driver Version |
| -------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- | ------------------------ |
| `sslMode`                        | Specifies the SSL/TLS mode. It can have one of the following values:<ul> <li><code>disable</code>: Disable the use of SSL/TLS.</li> <li><code>trust</code>: Use SSL/TLS only for encryption, and do not perform certificate or hostname verification. SingleStore does not recommend this mode for production environments.</li> <li><code>verify-ca</code>: Use SSL/TLS for encryption and perform certificate verification, but do not perform hostname verification.</li> <li><code>verify-full</code>: Use SSL/TLS for encryption, certificate verification, and hostname verification.</li> </ul>The following parameters can override the behavior of`sslMode`:<ul> <li><code>useSsl</code></li> <li><code>disableSslHostnameVerification</code></li> <li><code>trustServerCertificate</code></li> </ul>Refer to[`sslMode`and`useSsl`Behavior](https://docs.singlestore.com/#section-idm234602738206189.md)for more information. | `disable`     | 1.0.0+                   |
| `enabledSslCipherSuites`         | Specifies a comma-separated list of TLS ciphers. If specified, forces the TLS protocol to only use the specified ciphers.For example,`"TLS_DHE_RSA_WITH_AES_256_GCM_SHA384, TLS_DHE_DSS_WITH_AES_256_GCM_SHA384"`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |               | 1.0.0+                   |
| `enabledSslProtocolSuites`       | Specifies a comma-separated list of TLS versions. If specified, forces the TLS protocol to only use the specified version(s).For example,`"TLSv1, TLSv1.1, TLSv1.2"`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |               | 1.0.0+                   |
| `keyStore`                       | Specifies the path of the`keyStore`file that contains the client private keys and associated certificates.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |               | 1.0.0+                   |
| `keyStorePassword`               | Specifies the password for the`keyStore`file.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |               | 1.0.0+                   |
| `keyStoreType`                   | Specifies the key store type, for example, JKS and PKCS12.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |               | 1.0.0+                   |
| `keyPassword`                    | Specifies the password for the private key in the client certificate`keyStore`file.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |               | 1.2.1+                   |
| `serverSslCert`                  | Use this parameter to specify the server's certificate in DER format or specify the server's CA certificate. The server is added to`trustStor`, which allows the connection to trust a self-signed certificate.You can specify the server certificate in one of the following formats:<ul> <li>Specify the complete path: <code>serverSslCert=/full_path/cert.pem</code></li> <li>Specify a relative path: <code>serverSslCert=classpath:relative/cert.pem</code></li> <li>Specify a DER-encoded certificate string: <code>"------BEGIN CERTIFICATE-----"</code></li> </ul>                                                                                                                                                                                                                                                                                                                                                            |               | 1.0.0+                   |
| `trustStore`                     | Specifies the path of the`trustStore`file, and uses the specified file for trusted root certificates. If this parameter is set, it overrides the`serverSslCert`parameter.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |               | 1.1.4+                   |
| `trustStorePassword`             | Specifies the password for the trusted root certificate file.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |               | 1.1.4+                   |
| `trustStoreType`                 | Specifies the trust store type, for example, JKS and PKCS12.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | `null`        | 1.1.4+                   |
| `disableSslHostnameVerification` | Disables hostname verification against the server's identity as specified in the server's certificate to prevent man-in-the-middle attacks. This parameter is effective only when the`useSsl`parameter is enabled.Refer to[`sslMode`and`useSsl`Behavior](https://docs.singlestore.com/#section-idm234602738206189.md)for related information.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          | `false`       | 1.0.0+                   |
| `trustServerCertificate`         | Enable this parameter to skip checking the server's certificate when used in conjunction with SSL/TLS. This parameter is effective only when the`useSsl`parameter is enabled.Refer to[`sslMode`and`useSsl`Behavior](https://docs.singlestore.com/#section-idm234602738206189.md)for related information.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               | `FALSE`       | 1.0.0+                   |
| `useSsl`                         | Force enables[SSL/TLS](https://mariadb.com/kb/en/mariadb/secure-connections-overview/secure-connections-overview)on the connection. Use`useSSL`as an alias for this parameter.Refer to[`sslMode`and`useSsl`Behavior](https://docs.singlestore.com/#section-idm234602738206189.md)for related information.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | `FALSE`       | 1.0.0+                   |

## `sslMode` and `useSsl` Behavior

The `sslMode` and `useSsl` parameters can both be used to enable SSL/TLS on the connection. However, the `useSsl` parameter can override the value of `sslMode` parameter when used in conjunction with the `disableSslHostnameVerification` and `trustServerCertificate` parameters.

The following table shows the equivalent `sslMode` for different combinations of `useSsl`, `disableSslHostnameVerification`, and `trustServerCertificate`

| `useSsl` | `trustServerCertificate` | `disableSslHostnameVerification` | Equivalent`sslMode` |
| -------- | ------------------------ | -------------------------------- | ------------------- |
| `FALSE`  | Ignored                  | Ignored                          | `disable`           |
| `TRUE`   | `TRUE`                   | Ignored                          | `trust`             |
| `TRUE`   | `FALSE`                  | `TRUE`                           | `verify-ca`         |
| `TRUE`   | `FALSE`                  | `FALSE`                          | `verify-full`       |

## Pool Parameters

| Parameter            | Description                                                                                                                                                                                                                                 | Default Value                  | Supported Driver Version |
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------ | ------------------------ |
| `pool`               | Specifies that the connection uses a connection pool. Enable this option to use a connection object, but not a`DataSource`object.                                                                                                           | `FALSE`                        | 1.0.0+                   |
| `poolName`           | Specifies the pool name that allows identifying threads. The`poolName`is auto-generated by default.                                                                                                                                         | SingleStore-pool-\<pool-index> | 1.0.0+                   |
| `maxPoolSize`        | Specifies the maximum number of physical connections for a connection pool.                                                                                                                                                                 | 8                              | 1.0.0+                   |
| `minPoolSize`        | Specifies the minimum number of physical connections that must always be available in a connection pool.`minPoolSize`should never be greater than`maxPoolSize`.                                                                             | `maxPoolSize`                  | 1.0.0+                   |
| `poolValidMinDelay`  | Disables connection state validation for connections that request a new connection within the time limit specified through`poolValidMinDelay`. The time limit must be specified in*ms*. If set to`0`, each connection request is validated. | 1000                           | 1.0.0+                   |
| `maxIdleTime`        | Specifies the maximum amount of time (in`seconds`) a connection can stay in the pool in idle state. This parameter can be set to a minimum of*2 seconds*.                                                                                   | 600                            | 1.0.0+                   |
| `useResetConnection` | When enabled, resets the connection state, deletes the prepare command, resets the session variables, and removes the user variables. User variables are removed only when the server allows deleting them.                                 | `FALSE`                        | 1.0.0+                   |

## Log Parameters

| Parameter                 | Description                                                                             | Default Value | Supported Driver Version |
| ------------------------- | --------------------------------------------------------------------------------------- | ------------- | ------------------------ |
| `log`                     | Enables information logging.                                                            | `FALSE`       |                          |
| `maxQuerySizeToLog`       | Specifies the size of the query statement to include in the log.                        | 1024          | 1.0.0+                   |
| `slowQueryThresholdNanos` | Logs queries with execution time greater than the value specified using this parameter. | 1024          |                          |
| `profileSql`              | Enables logging the query execution time.                                               | `FALSE`       |                          |

## Other Parameters

| Parameter                               | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | Default Value | Supported Driver Version |
| --------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- | ------------------------ |
| `allowMultiQueries`                     | Enables multi-query statements.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | `FALSE`       | 1.0.0+                   |
| `autocommit`                            | Sets the`autocommit`value to the default value on connection initialization.                                                                                                                                                                                                                                                                                                                                                                                                                                        | `TRUE`        | 1.0.0+                   |
| `blankTableNameMeta`                    | Returns a blank value for table name in the`getTableName`metadata result set.                                                                                                                                                                                                                                                                                                                                                                                                                                       | `FALSE`       | 1.0.0+                   |
| `cachePrepStmts`                        | If`useServerPrepStmts`is set to`TRUE`, enabling`cachePrepStmts`caches prepared statements in a LRU cache to avoid preparing the query again, which allows the server from re-parsing a query.                                                                                                                                                                                                                                                                                                                       | `TRUE`        | 1.0.0+                   |
| `connectionAttributes`                  | Set client information in`key:value`pair format, when`performance_schema`is enabled. This is currently only enabled on the client side (does not send the key:value pairs to the server). Best practice is to use this parameter to identify the calling client for special handling in the driver and in future telemetry information forSingleStore.                                                                                                                                                              |               | 1.0.0+                   |
| `consoleLogFilepath`                    | Specifies the path of the console log file. If the`consoleLogLevel`and`consoleLogFilepath`parameters are set to`NULL`, the SLF4J logger is used.                                                                                                                                                                                                                                                                                                                                                                    | `NULL`        | 1.2.0+                   |
| `consoleLogLevel`                       | Specifies the console log level. It can have one of the following values:`ERROR`,`WARN`,`INFO`,`DEBUG`, and`TRACE`. If the`consoleLogLevel`and`consoleLogFilepath`parameters are set to`NULL`, the SLF4J logger is used.                                                                                                                                                                                                                                                                                            | `INFO`        | 1.1.6+                   |
| `createDatabaseIfNotExist`              | When enabled, the database specified in the connection string is created if it doesn't already exist.                                                                                                                                                                                                                                                                                                                                                                                                               | `FALSE`       | 1.1.9+                   |
| `credentialType`                        | Specifies the credential plugin type. The plugin must be added to`CLASSPATH`.                                                                                                                                                                                                                                                                                                                                                                                                                                       |               | 1.0.0+                   |
| `defaultFetchSize`                      | Calls the`setFetchSize(n)`method with the value specified using the`defaultFetchSize`parameter. Refer to[Fetch Size Behavior](https://docs.singlestore.com/#section-id235376537498863.md)for more information.                                                                                                                                                                                                                                                                                                      | 0             | 1.0.0+                   |
| `dumpQueriesOnException`                | Enables logging the query string when an exception is thrown during query execution.                                                                                                                                                                                                                                                                                                                                                                                                                                | `FALSE`       | 1.0.0+                   |
| `enableExtendedDataTypes`               | Enables extended data types, by enabling the`enable_extended_types_metadata`engine variable, that allow the JDBC driver to support extended data types, such as`VECTOR`and`BSON`.                                                                                                                                                                                                                                                                                                                                   | `FALSE`       | 1.2.6+                   |
| `includeThreadDumpInDeadlockExceptions` | Adds thread dump to exception trace log in case of a deadlock exception.                                                                                                                                                                                                                                                                                                                                                                                                                                            | `FALSE`       | 1.0.0+                   |
| `initSql`                               | Specifies the commands to run when a new connection is created.                                                                                                                                                                                                                                                                                                                                                                                                                                                     |               | 1.1.9+                   |
| `localSocket`                           | Enables connecting to a database socket via a UNIX domain socket (if allowed by the server).                                                                                                                                                                                                                                                                                                                                                                                                                        |               | 1.0.0+                   |
| `localSocketAddress`                    | Binds the specified hostname or IP address to a local (UNIX domain) socket.                                                                                                                                                                                                                                                                                                                                                                                                                                         |               | 1.0.0+                   |
| `maxAllowedPacket`                      | If enabled, allows the driver to avoid sending commands with packet size greater than the value of the`max_allowed_packet`engine variable and throw an error instead of dropping the connection. If this parameter is not set or set to`NULL`, it is ignored.                                                                                                                                                                                                                                                       |               | 1.2.0+                   |
| `maxPrintStackSizeToLog`                | Limits the number of stack trace lines to log.                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | `10`          | 1.1.9+                   |
| `nullDatabaseMeansCurrent`              | If enabled, the`null`value in 'DatabaseMetadata' methods refers to the current database.                                                                                                                                                                                                                                                                                                                                                                                                                            | `FALSE`       | 1.2.7+                   |
| `prepStmtCacheSize`                     | If`useServerPrepStmts`is set to`TRUE`,`prepStmtCacheSize`specifies the prepared statement cache size.                                                                                                                                                                                                                                                                                                                                                                                                               | 250           | 1.0.0+                   |
| `printStackTrace`                       | When enabled, it prints the stack trace for the`TRACE`log level.                                                                                                                                                                                                                                                                                                                                                                                                                                                    | `FALSE`       | 1.1.9+                   |
| `restrictedAuth`                        | Specifies a comma-separated list of client authentication plugins to allow. If this parameter is set, allowed authentication plugins are restricted to the specified list. By default (when`restrictedAuth`is not set), the driver allows all supported client authentication plugins.For example, the following connection string only allows the`mysql_native_password`and`client_ed25519`client authentication plugins:`jdbc:singlestore:<host:port>/dbTest?restrictedAuth=mysql_native_password,client_ed25519` | `null`        | 1.0.0+                   |
| `rewriteBatchedStatements`              | If enabled, sends multiple rows in a single query. Note that, if the`useServerPrepStmts`parameter is enabled,`rewriteBatchedStatements`has no effect (it is ignored). The queries must be specified in the`INSERT INTO <table-name> (column-list) VALUES (...)`format.                                                                                                                                                                                                                                              | `FALSE`       | 1.1.5+                   |
| `sessionVariable`                       | SetsSingleStoresession variables specified as \<var\_name> = \<value> pairs.                                                                                                                                                                                                                                                                                                                                                                                                                                        |               |                          |
| `socketFactory`                         | Specifies the name of the custom socket factory to use. Specify the full name of the class that implements`javax.net.SocketFactory`.                                                                                                                                                                                                                                                                                                                                                                                |               | 1.0.0+                   |
| `socketTimeout`                         | Specifies the network socket timeout (in*ms*), i.e., the maximum time the driver waits for a response after a connection is established. Upon timeout, the connection is forcibly closed.If set to`0`, socket timeout is disabled.                                                                                                                                                                                                                                                                                  | 0             | 1.0.0+                   |
| `tcpAbortiveClose`                      | Resets TCP connections (through abort or hard close) instead of orderly closing connections. This option is useful in environments where connections are opened and closed frequently. In such environments, it may not be possible to create new sockets because all ports are used by connections in`TCP_WAIT`state.                                                                                                                                                                                              |               | 1.0.0+                   |
| `tcpKeepAlive`                          | Enables`TCPKeepAlive`for the JDBC client to keep idle TCP connections connected.                                                                                                                                                                                                                                                                                                                                                                                                                                    | `TRUE`        | 1.0.0+                   |
| `tcpKeepCount`                          | Specifies the number of keepalive probes (checks) sent to check if the connection is active before the connection is considered closed if no response is received.This parameter is only supported in Java version 11+.                                                                                                                                                                                                                                                                                             | `null`        | 1.0.0+                   |
| `tcpKeepIdle`                           | Specifies the timeout (in seconds) the connection can remain idle before sending keepalive probes (checks).This parameter is only supported in Java version 11+.                                                                                                                                                                                                                                                                                                                                                    | `null`        | 1.0.0+                   |
| `tcpKeepInterval`                       | Specifies the interval (in seconds) between each keepalive probe (check) sent if a response is not received for a previous probe.This parameter is only supported in Java version 11+.                                                                                                                                                                                                                                                                                                                              | `null`        | 1.0.0+                   |
| `tinyInt1isBit`                         | Maps MySQL Tiny data type to BIT (boolean) data type.                                                                                                                                                                                                                                                                                                                                                                                                                                                               | `TRUE`        | 1.0.0+                   |
| `tlsSocketType`                         | Uses the TLS`com.singlestore.jdbc.tls.TlsSocketPlugin`plugin. The plugin must be added to`CLASSPATH`.                                                                                                                                                                                                                                                                                                                                                                                                               |               | 1.0.0+                   |
| `transformedBitIsBoolean`               | Maps the`TINYINT`data type transformed using`tinyInt1isBit`from`BIT`to`BOOLEAN`. This parameter is effective only when`tinyInt1isBit`is enabled. A`TINYINT`value of`0`is considered`FALSE`, and non-zero values are considered`TRUE`.                                                                                                                                                                                                                                                                               | `FALSE`       | 1.2.0+                   |
| `useReadAheadInput`                     | Enables using a buffered`inputStream`to read available socket data                                                                                                                                                                                                                                                                                                                                                                                                                                                  | `TRUE`        | 1.0.0+                   |
| `vectorExtendedMetadata`                | Enables the extended metadata for the`VECTOR`types defined in the`'VECTOR(<N>[, <elementType>])'`format.                                                                                                                                                                                                                                                                                                                                                                                                            | `FALSE`       | 1.2.7+                   |
| `vectorTypeOutputFormat`                | Specifies whether the`VECTOR`type columns are projected as JSON or binary (in the output), by configuring the`vector_type_project_format`engine variable. It can have the following values:`JSON`or`BINARY`. Refer to[Vector Type](https://docs.singlestore.com/db/v9.1/reference/sql-reference/data-types/vector-type.md)for more information.                                                                                                                                                                     | `null`        | 1.2.6+                   |
| `yearIsDateType`                        | Converts year values from numerical to`DATE`type.                                                                                                                                                                                                                                                                                                                                                                                                                                                                   | `TRUE`        | 1.0.0+                   |

## Failover and Load Balancing Parameters

| Parameter               | Description                                                                                                                                                                                   | Default Value | Supported Driver Version |
| ----------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- | ------------------------ |
| `retriesAllDown`        | Specifies the maximum time until the driver retries connection attempts before throwing an exception, when the driver is performing a failover and all hosts are down.                        | 120           | 1.0.0+                   |
| `deniedListTimeout`     | Specifies the time duration a failed host remains in the denied list when the connector is performing a failover.                                                                             | 60            | 1.0.0+                   |
| `transactionReplay`     | Specifies if the current transaction can have a completely transparent failover. To enable this parameter, all the commands must be idempotent (return the same result at each run).          | `FALSE`       | 1.0.0+                   |
| `transactionReplaySize` | Specifies the maximum size limit for the replay cache buffer. If a transaction exceeds the specified limit and a failover occurs, the transaction throws an exception and it is not replayed. | `64`          | 1.2.0+                   |

***

Modified at: January 19, 2026

Source: [/db/v9.1/developer-resources/connect-with-application-development-tools/connect-with-java-jdbc/the-singlestore-jdbc-driver/](https://docs.singlestore.com/db/v9.1/developer-resources/connect-with-application-development-tools/connect-with-java-jdbc/the-singlestore-jdbc-driver/)

(An index of the documentation is available at /llms.txt)
