Connection Profiles

An ADBC connection profile combines a driver name and database options into a reusable, named configuration stored in a TOML file. This keeps credentials and settings out of your application code.

Here are example profiles for a few databases. Each sets driver to a driver name (see Drivers) and puts that driver’s options under [Options]. Secrets are injected from environment variables with {{ env_var(NAME) }} rather than being written into the file:

profile_version = 1
driver = "postgresql"

[Options]
uri = "postgresql://postgres:{{ env_var(PGPASSWORD) }}@localhost:5432/demo"
profile_version = 1
driver = "bigquery"

[Options]
"adbc.bigquery.sql.project_id" = "my-gcp-project"
"adbc.bigquery.sql.dataset_id" = "bigquery-public-data"
profile_version = 1
driver = "redshift"

[Options]
uri = "postgresql://localhost:5439"
"redshift.cluster_type" = "redshift-serverless"
"redshift.workgroup_name" = "my-workgroup"
"redshift.db_name" = "sample_data_dev"
profile_version = 1
driver = "snowflake"

[Options]
username = "MYUSER"
"adbc.snowflake.sql.auth_type" = "auth_jwt"
"adbc.snowflake.sql.client_option.jwt_private_key" = "/path/to/rsa_key.p8"
"adbc.snowflake.sql.account" = "ACCOUNT-IDENT"
"adbc.snowflake.sql.db" = "SNOWFLAKE_SAMPLE_DATA"
"adbc.snowflake.sql.schema" = "TPCH_SF1"
"adbc.snowflake.sql.warehouse" = "MY_WAREHOUSE"
"adbc.snowflake.sql.role" = "MY_ROLE"
profile_version = 1
driver = "flightsql"

[Options]
uri = "grpc://localhost:9408"
username = "root"
password = "{{ env_var(STARROCKS_PASSWORD) }}"

Save the profile as a .toml file (for example myprofile.toml) in the user configuration directory, where the client library or driver manager looks for it by name:

  • Linux: ~/.config/adbc/profiles/

  • macOS: ~/Library/Application Support/ADBC/Profiles/

  • Windows: %LOCALAPPDATA%\ADBC\Profiles\

Other locations are also searched; see Profile Search Locations for the full list and precedence.

Your application then references the profile at connection time, and the client library or driver manager loads it automatically. Point the uri option at the profile name—the TOML file’s name without the .toml extension—using the profile:// scheme:

AdbcDatabase database = {};
AdbcDatabaseNew(&database, &error);
AdbcDatabaseSetOption(&database, "uri", "profile://myprofile", &error);
AdbcDriverManagerDatabaseSetLoadFlags(&database, ADBC_LOAD_FLAG_DEFAULT, &error);
AdbcDatabaseInit(&database, &error);
var drv drivermgr.Driver

db, err := drv.NewDatabase(map[string]string{
    "uri": "profile://myprofile",
})
Map<String, Object> params = new HashMap<>();
JniDriver.PARAM_URI.set(params, "profile://myprofile");

AdbcDatabase db =
    AdbcDriverManager.getInstance().connect(DRIVER_FACTORY, allocator, params);
import { AdbcDatabase } from '@apache-arrow/adbc-driver-manager';

const db = new AdbcDatabase({
  databaseOptions: { uri: 'profile://myprofile' },
});
from adbc_driver_manager import dbapi

with dbapi.connect(uri="profile://myprofile") as con:
    ...
library(adbcdrivermanager)

db <- adbc_database_init(uri = "profile://myprofile")
con <- adbc_connection_init(db)
database = ADBC::Database.new
database.set_option("uri", "profile://myprofile")
database.set_load_flags(ADBC::LoadFlags::DEFAULT)
database.init
let uri = "profile://myprofile";
let db = ManagedDatabase::from_uri(
    uri, None, AdbcVersion::default(), LOAD_FLAG_DEFAULT, None,
)?;

You can also pass an absolute path to a profile file instead of a name. For full details on the profile file format, search paths, option precedence, and how to implement a custom profile provider, see ADBC Driver Manager and Connection Profiles.