ODBC

Call to ODBC

Overview

This node allows you to execute SQL queries on databases accessible via ODBC (Open Database Connectivity). It supports several predefined ODBC types such as PostgreSQL, SQL Server, and HFSQL, as well as a custom connection string option for other ODBC sources. The node is useful when you want to integrate data from various database systems into your n8n workflows by running arbitrary SQL queries.

Common scenarios include:

  • Querying a PostgreSQL or SQL Server database to retrieve or manipulate data.
  • Connecting to less common databases using a custom ODBC connection string.
  • Running complex SQL queries as part of an automated workflow to fetch or update records.

Example use case:

  • Fetching user data from a PostgreSQL database to enrich customer profiles in a CRM system.
  • Executing maintenance queries on a SQL Server database during off-hours.

Properties

Name Meaning
ODBC Type Select the ODBC driver type: Custom, PostgreSQL, SQL Server, or HFSQL
Driver The database driver name (hidden if "Custom" is selected)
Custom Connection String A full custom ODBC connection string (shown only if "Custom" is selected)
Host The hostname or IP address of the database server (hidden if "Custom" is selected)
Port The port number of the database server (hidden if "Custom" is selected)
Database Name The name of the target database
User Username for authenticating with the database (hidden if "Custom" is selected)
Password Password for authenticating with the database (hidden if "Custom" is selected)
Query The SQL query string to execute

Output

The node outputs the result of the executed SQL query as JSON. The output is an array of objects where each object represents a row returned by the query, with key-value pairs corresponding to column names and their values.

If the query modifies data (e.g., INSERT, UPDATE), the output will contain information about affected rows depending on the database driver behavior.

No binary data output is produced by this node.

Dependencies

  • Requires the odbc Node.js package to establish connections and run queries.
  • The target database must be accessible via an ODBC driver installed on the host running n8n.
  • Proper credentials and network access to the database are necessary.
  • No internal credential types are used; authentication details are provided directly as node parameters.

Troubleshooting

  • Connection errors: Ensure the ODBC driver is correctly installed and the connection string parameters (host, port, driver, etc.) are accurate.
  • Authentication failures: Verify username and password correctness.
  • Query syntax errors: Check the SQL query syntax matches the target database dialect.
  • Timeouts or network issues: Confirm that the database server is reachable from the n8n instance.
  • Empty results: Make sure the query is correct and the database contains matching data.

Common error messages typically relate to invalid connection strings, authentication failure, or SQL syntax errors. Resolving these involves verifying connection parameters, credentials, and query correctness.

Links and References

Discussion