Skip to main content

SQL Drivers

This guide covers User-Agent configuration for Databricks SQL drivers. Each driver provides a specific parameter or option for setting the partner identifier.

Databricks JDBC driver

For the Databricks OSS JDBC driver, set the UserAgentEntry parameter when connecting to Databricks.

Using JDBC URL (DriverManager)

Add UserAgentEntry directly to the JDBC connection string:

String jdbcUrl =
"jdbc:databricks://<host>:443/default;" +
"AuthMech=11;" +
"Auth_Flow=1;" +
"OAuth2ClientId=<client-id>;" +
"OAuth2Secret=<client-secret>;" +
"HttpPath=<http-path>;" +
"SSL=1;" +
"UserAgentEntry=<isv-name_product-name>/<product-version>;";

Connection conn = DriverManager.getConnection(jdbcUrl);

Using DataSource

The UserAgentEntry parameter is added as part of the connection properties when using a JDBC DataSource:

import com.databricks.client.jdbc.DataSource;

DataSource ds = new DataSource();

Properties props = new Properties();
props.setProperty("UserAgentEntry", "<isv-name_product-name>/<product-version>");

// Add required connection properties
props.setProperty("AuthMech", "11");
props.setProperty("Auth_Flow", "1");
props.setProperty("OAuth2ClientId", "<client-id>");
props.setProperty("OAuth2Secret", "<client-secret>");
props.setProperty("SSL", "1");

// Apply the properties to the DataSource
ds.setProperties(props);

Connection conn = ds.getConnection();

Databricks ODBC driver

For the Databricks (Simba) ODBC driver, add UserAgentEntry to the DSN or connection string.

DSN configuration (non-Windows)

[Databricks]
Driver=<path-to-driver>
Host=<server-hostname>
Port=443
HTTPPath=<http-path>
SSL=1
ThriftTransport=2
UserAgentEntry=<isv-name_product-name>/<product-version>

DSN-less connection string

Driver=<path-to-driver>;
Host=<server-hostname>;
Port=443;
HTTPPath=<http-path>;
SSL=1;
ThriftTransport=2;
UserAgentEntry=<isv-name_product-name>/<product-version>;

Databricks Node.js driver

For the Databricks SQL Driver for Node.js, specify the User-Agent identifier using the userAgentEntry property when creating the client connection:

const { DBSQLClient } = require('@databricks/sql');

const client = new DBSQLClient();
client.connect({
host: process.env.DATABRICKS_SERVER_HOSTNAME,
path: process.env.DATABRICKS_HTTP_PATH,
// ... other connection options
userAgentEntry: '<isv-name_product-name>/<product-version>',
});

Databricks Go SQL driver

For the Databricks SQL Driver for Go, include the User-Agent identifier using the WithUserAgentEntry option when creating the connector:

connector, err := dbsql.NewConnector(
dbsql.WithServerHostname(os.Getenv("DATABRICKS_HOST")),
dbsql.WithPort(443),
dbsql.WithHTTPPath(os.Getenv("DATABRICKS_HTTP_PATH")),
dbsql.WithUserAgentEntry("<isv-name_product-name>/<product-version>"),
)

What's next