ODBC
The MotherDuck integration with ODBC is no different than DuckDB. For more information, see ODBC in DuckDB Documentation.
To reach MotherDuck, set the Database field of your DSN to a MotherDuck database with the md: prefix:
md:my_database
Authenticating with an access token
With no token configured, the driver opens a browser sign-in prompt, and every application that uses the DSN prompts again each session. To authenticate the DSN itself, append your access token to the Database field as a connection string parameter:
md:my_database?motherduck_token=<your_motherduck_token>
This works for any application that reads the DSN, including tools that don't expose a separate field for driver connection properties.
Add any other connection string parameter the same way, separated by &. BI tools often benefit from attach_mode=single, because their catalog browsers can be confused by multiple attached databases:
md:my_database?motherduck_token=<your_motherduck_token>&attach_mode=single
To serve several people from one DSN, create the token on a service account and give it a read scaling pool size that matches your expected number of concurrent users.
Windows DSN fields truncate long tokens
The ODBC Data Source Administrator shortens the Database field. The text box holds around 255 characters and saves a truncated value without reporting an error. A truncated token fails to authenticate, so the connection falls back to the browser prompt.
Write the full value into the registry instead:
- Open Registry Editor by running
regedit. - Navigate to the key for your DSN:
- System DSN:
HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\<your_dsn_name> - 32-bit System DSN:
HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\ODBC\ODBC.INI\<your_dsn_name> - User DSN:
HKEY_CURRENT_USER\SOFTWARE\ODBC\ODBC.INI\<your_dsn_name>
- System DSN:
- Double-click
Database, paste the fullmd:my_database?motherduck_token=<your_motherduck_token>value, and click OK.
Restart the application that uses the DSN to pick up the change.