Linux DSN Configuration
This section describes how to set up ODBC connectivity and configure DSNs on several Linux distributions: Debian-based systems, like Ubuntu, and Red Hat Linux platforms, like Red Hat Enterprise Linux (RHEL) and Fedora.
Minimum Linux Versions
Here are the minimum supported versions for Red Hat-based and Debian-based systems:
| OS | Min. Version |
| Ubuntu | 18.04 |
| Debian | 10 |
| RHEL | 8 |
| Fedora | 28 |
| SUSE | 15 |
Installing the Driver Dependencies
Run the following commands as root or with sudo to install the necessary dependencies:
- Debian/Ubuntu:
apt-get install libc6 libstdc++6 zlib1g libgcc1
- RHEL/Fedora:
yum install glibc libstdc++ zlib libgcc
Installing the Driver
You can use standard package management systems to install the driver.
On Debian-based systems, like Ubuntu, run the following command with root or sudo:
dpkg -i /path/to/driver/setup/OdooODBCDriverforUnix.deb
On systems that support the RPM package format, run the following command with root or sudo:
rpm -ivh /path/to/driver/OdooODBCDriverforUnix.rpm
Licensing the Driver
Run the following commands to license the driver. To activate a trial, omit the <key> input.
cd /opt/cdata/cdata-odbc-driver-for-odoo/bin/
sudo ./install-license.sh <key>
Connecting through the Driver Manager
The driver manager loads the driver and passes function calls from the application to the driver. You need to register the driver with the driver manager and you define DSNs in the driver manager's configuration files.
The driver installation registers the driver with the unixODBC driver manager and creates a system DSN. The unixODBC driver manager can be used from Python and from many other applications. Your application may embed another driver manager.
Creating the DSN
See Using unixODBC to install unixODBC and configure DSNs. See Using the DataDirect Driver Manager to create a DSN to connect to OBIEE, Informatica, and SAS.
Connecting to Odoo
To connect, set the URL to your Odoo instance URL, User and APIToken to your user credentials, and Database to your Odoo database name.
If you are not using an API token (available only in Odoo 14 and later), you can enter your password directly into the APIToken field instead.
Quick Start: Connecting to Odoo Online
The steps below are a typical setup for connecting to Odoo Online:
- Set OdooEdition to Online.
- Set URL to the full URL of your Odoo instance, such as https://mycompany.odoo.com.
- Set User to your Odoo login (email or username).
- Set APIToken to your API key or password.
- Set Database to your database name (optional for Odoo Online, required for On-Premises).
Note: For On-Premises Odoo, the steps are similar, but you must always provide Database and ensure your server is accessible to the driver. For Odoo Online, the database may be detected automatically, but setting it is recommended.
Odoo Edition
The OdooEdition property determines how the connection is established. Odoo offers two different types of environments, and this setting tells the driver which one you are using:
- Online: For Odoo's cloud-hosted SaaS version at odoo.com
- OnPrem: For Odoo installations that you or your company host on your own servers
If you're unsure, use Online if you access Odoo from a web address like yourcompany.odoo.com. Use OnPrem if your organization manages its own Odoo server (often accessed via a custom domain or local network).
Database
Odoo supports multiple databases under the same server. You must provide the name of the specific database you want to connect to.
- For Odoo Online: The database name is often included in the web address, and the driver may be able to detect it automatically if Database is left blank. However, in some cases, the database is not visible in the URL and must be specified manually. Setting this value is always recommended for reliability.
- For Odoo On-Premises: You must set the Database property. The driver cannot detect the database automatically in this case.
How to Find Your Database Name (Odoo Online)
- Log into your Odoo Online account
- Click your profile icon in the top-right corner and choose My Databases
- Your database name will be listed in the table
Alternatively, you can often see the database name in the subdomain of your URL. If your address is https://mycompany.odoo.com, your database name is likely mycompany.
Access Rights
To discover available models (tables) in Odoo, the driver checks the internal ir.model.access table, which defines what models a user is allowed to see.
By default, only Odoo administrators have permission to read this table. To give a non-admin user access, create a new group:
- Log in as an administrator and enable developer mode in Odoo settings.
- Open the Groups page (under the Users drop-down) and create a new group.
- Set the Application to Administration and name the group "Service Access".
- Add the users who need access under the Users tab.
- In the Access Rights tab, add a permission for ir.model.access (or Model Access), check Read, and name it Inspect Models.
If you're unable to grant access in this way, set the CheckPermissions property to false. This disables permission checking and allows the driver to list all available models, even if the user doesn't have explicit access.
Troubleshooting
If you encounter errors like missing database or authentication failed, try the following:
- Double-check the value of Database, especially for On-Prem environments.
- Make sure your user credentials are valid by logging into Odoo directly.
- If using Odoo Online, try leaving Database blank and allow auto-detection.
- Ensure the correct OdooEdition is set (Online vs OnPrem).
Set the Driver Encoding
The ODBC drivers need to specify which encoding to use with the ODBC Driver Manager. By default, the CData ODBC Drivers for Unix are configured to use UTF-16 which is compatible with unixODBC, but other Driver Managers may require alternative encoding.
Alternatively, if you are using the ODBC driver from an application that uses the ANSI ODBC API it may be necessary to set the ANSI code page. For example, to import Japanese characters in an ANSI application, you can specify the code page in the config file '/opt/cdata/cdata-odbc-driver-for-odoo/lib/cdata.odbc.odoo.ini':
[Driver]
AnsiCodePage = 932