Execute SQL queries with ODBC
Use the Arrow Flight SQL ODBC driver to execute SQL queries against InfluxDB 3 Enterprise from ODBC-compatible applications and programming languages.
ODBC (Open Database Connectivity) is a standard API for accessing database management systems. The Arrow Flight SQL ODBC driver enables ODBC-compatible applications to connect to InfluxDB 3 Enterprise and query data using SQL.
- Download and install the ODBC driver
- Configure a data source
- Connect and query from applications
- Use ODBC with programming languages
Download and install the ODBC driver
InfluxDB 3 Enterprise uses the Arrow Flight SQL ODBC driver to enable ODBC connectivity.
For more information about the Arrow Flight SQL ODBC Driver, see the Dremio documentation.
Run the following PowerShell commands to download and install:
# Set the driver path
$driverPath = "C:\Users\YOUR_USER\Downloads\arrow-flight-sql-odbc-0.9.7.1195-win64.msi"
# Download the driver
Invoke-WebRequest -Uri "https://docs.influxdata.com/downloads/arrow-flight-sql-odbc-0.9.7.1195-win64.msi" `
-OutFile $driverPath
# Mark as trusted
Unblock-File $driverPath
# Install
Start-Process msiexec.exe -Wait -ArgumentList "/i `"$driverPath`""
Replace the following:
YOUR_USER
: Your Windows username
Verify installation
- Open ODBC Data Source Administrator (64-bit)
- Navigate to the Drivers tab
- Verify Arrow Flight SQL ODBC Driver appears in the list
Download the Arrow Flight SQL ODBC driver
- Run the downloaded
.msi
installer - Follow the installation wizard using default settings
- Complete the installation
Verify installation
- Open ODBC Data Source Administrator (64-bit)
- Navigate to the Drivers tab
- Verify Arrow Flight SQL ODBC Driver appears in the list
Download from Dremio:
Install on macOS
- Run the downloaded
.pkg
installer - Follow the installation prompts
- Enter your administrator password when prompted
- Complete the installation
Install on Linux
Extract the downloaded archive:
tar -xzf arrow-flight-sql-odbc-LATEST-linux-x86_64.tar.gz
Install the driver (installation location may vary by distribution):
sudo mkdir -p /opt/arrow-flight-sql-odbc sudo cp -r lib /opt/arrow-flight-sql-odbc/
Configure the driver in
/etc/odbcinst.ini
:[Arrow Flight SQL ODBC Driver] Description = Arrow Flight SQL ODBC Driver Driver = /opt/arrow-flight-sql-odbc/lib/libarrow-odbc.so
Verify installation
To verify the driver is installed correctly, run:
odbcinst -q -d
The output should include Arrow Flight SQL.
Configure a data source
After installing the Arrow Flight SQL ODBC driver, configure a data source to connect to InfluxDB 3 Enterprise.
Open ODBC Data Source Administrator (64-bit)
Navigate to the System DSN or User DSN tab
Click Add
Select Arrow Flight SQL ODBC Driver and click Finish
Configure the connection:
- Data Source Name: Provide a descriptive name (for example,
InfluxDB3
) - Host: Your InfluxDB 3 Enterprise host (for example,
localhost
) - Port: Your InfluxDB URL port
8181
(default)) - Database: Your database name
- Auth Token: Your admin token with query permissions for the target database
- Use Encryption: Enable for HTTPS connections
- Data Source Name: Provide a descriptive name (for example,
Click Test to verify the connection
Click OK to save
Create or edit ~/.odbc.ini
(user DSN) or /etc/odbc.ini
(system DSN):
[InfluxDB3]
Driver = Arrow Flight SQL ODBC Driver
Host = localhost
Port = 8181
Database = DATABASE_NAME
AuthToken = DATABASE_TOKEN
UseEncryption = 1
Replace the following:
DATABASE_NAME
: Your database nameDATABASE_TOKEN
: Your database tokenwith query permissions
Test the connection:
isql -v InfluxDB3
Connect and query from applications
After configuring a data source, connect from ODBC-compatible applications:
Power BI
See Use Power BI to visualize data.
Tableau
See Use Tableau to visualize data.
Excel
- Open Excel
- Go to Data > Get Data > From Other Sources > From ODBC
- Select your InfluxDB data source
- Enter credentials if prompted
- Select tables and load data
DBeaver
- Create a new database connection
- Select ODBC as the connection type
- Configure the connection:
- Database/Schema: Your InfluxDB database
- ODBC DSN: Your configured data source name
- Test and save the connection
Use ODBC with programming languages
Python with pyodbc
import pyodbc
# Connect to InfluxDB
conn = pyodbc.connect(
'DSN=InfluxDB3',
autocommit=True
)
# Create cursor
cursor = conn.cursor()
# Execute query
cursor.execute("""
SELECT
time,
temp,
location
FROM
home
WHERE
time >= now() - INTERVAL '1 hour'
ORDER BY
time DESC
""")
# Fetch results
for row in cursor.fetchall():
print(row)
# Close connection
cursor.close()
conn.close()
R with RODBC
library(RODBC)
# Connect to InfluxDB
conn <- odbcConnect("InfluxDB3")
# Execute query
result <- sqlQuery(conn, "
SELECT
time,
temp,
location
FROM
home
WHERE
time >= now() - INTERVAL '1 hour'
ORDER BY
time DESC
")
# View results
print(result)
# Close connection
odbcClose(conn)
C# with System.Data.Odbc
using System;
using System.Data.Odbc;
class Program
{
static void Main()
{
string connectionString = "DSN=InfluxDB3";
using (OdbcConnection conn = new OdbcConnection(connectionString))
{
conn.Open();
string query = @"
SELECT
time,
temp,
location
FROM
home
WHERE
time >= now() - INTERVAL '1 hour'
ORDER BY
time DESC
";
using (OdbcCommand cmd = new OdbcCommand(query, conn))
using (OdbcDataReader reader = cmd.ExecuteReader())
{
while (reader.Read())
{
Console.WriteLine($"{reader["time"]} - {reader["temp"]} - {reader["location"]}");
}
}
}
}
}
Connection string format
For applications that use connection strings directly:
Driver={Arrow Flight SQL ODBC Driver};Host=HOST;Port=PORT;Database=DATABASE;AuthToken=TOKEN;UseEncryption=1
Example:
Driver={Arrow Flight SQL ODBC Driver};Host=localhost;Port=8181;Database=DATABASE_NAME;AuthToken=DATABASE_TOKEN;UseEncryption=1
Configuration options
Connection parameters
Parameter | Description | Default |
---|---|---|
Host | InfluxDB server hostname | Required |
Port | InfluxDB server port | Required (8181 ) |
Database | Database name | Required |
AuthToken | Authentication token | Required |
UseEncryption | Use encrypted connection | 1 (enabled) |
TrustedCerts | Path to trusted CA certificates | System default |
DisableCertificateVerification | Skip certificate verification | 0 (disabled) |
Advanced options
Add these to your DSN configuration or connection string as needed:
[InfluxDB3]
Driver = Arrow Flight SQL ODBC Driver
Host = localhost
Port = 8181
Database = mydb
AuthToken = your-token
UseEncryption = 1
DisableCertificateVerification = 0
Troubleshooting
Driver not found
If applications cannot find the Arrow Flight SQL ODBC driver:
- Open ODBC Data Source Administrator (64-bit)
- Navigate to the Drivers tab
- Verify Arrow Flight SQL ODBC Driver appears in the list
- If not listed, reinstall the driver
Run the following command to list installed drivers:
odbcinst -q -d
Verify Arrow Flight SQL appears in the output
Check
/etc/odbcinst.ini
for proper driver configurationEnsure the driver library path is correct
Connection failures
If you cannot connect to InfluxDB 3 Enterprise:
- Verify your InfluxDB 3 Enterprise instance is running and accessible
- Check host and port settings:
- Local instances:
localhost:8181
- Local instances:
- Ensure
UseEncryption
is set correctly for your connection type - Verify network connectivity and firewall rules allow connections
Authentication errors
If authentication fails:
- Confirm your token is valid and not expired
- Ensure the token is specified in the
AuthToken
parameter (notToken
) - Verify the token has query permissions for the target database
- Check that the token was copied correctly without extra spaces or characters
Query errors
If queries fail or return errors:
- Verify SQL syntax is correct for InfluxDB SQL
- Check that referenced tables (measurements) exist in the database
- Ensure column names match your schema
- Review the SQL reference for supported features
- For large result sets, consider adding
LIMIT
clauses
Performance issues
For slow queries or connection timeouts:
- Add time range filters to limit data scanned
- Use appropriate indexes if available
- Increase timeout values in your DSN configuration
- Monitor query execution plans for optimization opportunities
Was this page helpful?
Thank you for your feedback!
Support and feedback
Thank you for being part of our community! We welcome and encourage your feedback and bug reports for InfluxDB 3 Enterprise and this documentation. To find support, use the following resources:
Customers with an annual or support contract can contact InfluxData Support. Customers using a trial license can email trial@influxdata.com for assistance.