What's new Download Reportworq
⬇ Guide PDF

Connect SQL Server, OLE DB, and ODBC#

Reportworq reads relational databases through three built-in connectors in the datasource catalog: SQL Server, OleDB Provider, and ODBC Provider. All three take a connection string, expose tables, views, schemas, and columns, and back either a table pick or a raw SQL query in a data model and the =RWSQL worksheet function. This page helps you choose the right connector, lists what each one requires, walks through the shared connection editor, and gives an example connection string for each connector and for the most common databases behind them.

Two related connectors have their own pages: Connect SQLite for a file-backed SQLite database, and Connect CData sources for the API and SaaS systems (Salesforce, Jira, NetSuite, and others) that reach Reportworq through a CData driver.

Choose a connector#

The three connectors differ in what they can reach, what has to be installed on the Reportworq server, and where they run. The table below compares them.

Connector Best for Requires Benefits Watch out for
SQL Server Microsoft SQL Server (on-premises or in a VM), Azure SQL Database, Azure SQL Managed Instance Nothing to install. The Microsoft SQL client is built into Reportworq. The server must be reachable on its TCP port (1433 by default, or the named instance's port). Works on Windows and Linux servers. Fastest to set up. Supports SQL authentication, Windows authentication, and Microsoft Entra ID authentication. Encrypts the connection by default. Because encryption is on by default, a server with a self-signed or untrusted certificate fails until you trust the certificate or add TrustServerCertificate=True. Windows authentication runs as the Reportworq service account.
OleDB Provider A source that is only reachable through a Windows OLE DB provider: an Excel workbook, an Access database, or a text folder through the ACE provider; a vendor's own OLE DB provider; or SQL Server through the Microsoft OLE DB Driver when that is your standard. A Windows Reportworq server. The 64-bit OLE DB provider installed on that server. Reaches file-based sources and vendor providers with no DSN. Not available on a Linux server. A 32-bit provider is invisible to the 64-bit service. A table pick is schema-qualified only when the provider reports a schema; file-based ACE sources (Excel, Access, text) have none.
ODBC Provider Every other database: PostgreSQL, MySQL, Oracle, IBM DB2, Snowflake, and any source with an ODBC driver. Also the generic route on a Linux server. The vendor's 64-bit ODBC driver installed on the Reportworq server, plus a 64-bit System DSN if you connect through a DSN. On Linux, unixODBC plus the vendor's Linux driver. The broadest reach. Works on Windows and Linux. A DSN lets you prove the driver and credentials in the operating system's ODBC tool before Reportworq uses them. The Driver={...} name must match the installed driver name exactly. A User DSN or a 32-bit DSN is invisible to the service.

Recommendation. For Microsoft SQL Server and Azure SQL, use the SQL Server connector: there is nothing to install, it runs on both platforms, and its connection string is the simplest. For any other database, use the ODBC Provider with the vendor's 64-bit driver; this is also the only generic route on a Linux server. Use the OleDB Provider only when a source is reachable solely through a Windows OLE DB provider, such as the Microsoft ACE provider for Excel and Access files or a vendor-specific provider, or when your organization standardizes on the Microsoft OLE DB Driver for SQL Server.

Before you begin#

Configure the connection#

The three connectors share the same editor, so the procedure is the same. Only the connection string and, on the ODBC connector, one extra timeout field differ.

  1. Add the SQL Server, OleDB Provider, or ODBC Provider connector and open its editor.
  2. Keep Enable datasource connection selected.
  3. Enter a Datasource Name. Report authors reference the connection by this name, for example in the connectionName argument of =RWSQL, so choose a durable name.
  4. Enter the Connection String. Take a starting point from Example connection strings below. To insert a credential placeholder, select the %USERNAME% or %PASSWORD% link above the box; it copies the token to the clipboard.
  5. Enter the login in the %USERNAME% Variable field and the password in the %PASSWORD% Variable field. Both fields are masked and cannot be revealed after you save.
  6. Leave Validation Query at SELECT 1 unless the database rejects it. Oracle needs SELECT 1 FROM DUAL and IBM DB2 needs SELECT 1 FROM SYSIBM.SYSDUMMY1. Test connection runs this query.
  7. On the OleDB Provider and ODBC Provider, set Limit Query Type to the row-limit dialect of the database: Top for SQL Server and Access, Limit for PostgreSQL and MySQL, or Fetch First for Oracle and IBM DB2. Do not select Unavailable; a connection set to it cannot import fields or preview. The native SQL Server connector does not read this setting, so leave it at Top. See Advanced Options and Limit Query Type.
  8. If a query needs longer than 30 seconds, expand Advanced Options and raise Command Timeout. On the ODBC Provider only, Connection Timeout sets how long to wait for the connection to open.
  9. Save, then select Test connection. A reachable, correctly configured database returns "Success." If the test fails, see Troubleshooting.

Keep credentials out of the connection string#

Do not type a username or password into the connection string. Put the placeholders %USERNAME% and %PASSWORD% in the string and enter the real values in the masked %USERNAME% Variable and %PASSWORD% Variable fields. Reportworq substitutes them when it opens the connection, so the secrets never appear in the visible string. The connection string and both variables are stored encrypted. If a variable field is empty, its placeholder is replaced with an empty value.

The same placeholders work in every keyword position, so User ID=%USERNAME%, Uid=%USERNAME%, and PRIV_KEY_FILE_PWD=%PASSWORD% are all valid.

Example connection strings#

Every example uses the credential placeholders. Replace the server, database, and path values with your own; keywords are not case-sensitive and each setting ends with a semicolon. Paste the string into the Connection String box as one line.

SQL Server#

The SQL Server connector opens the connection with the Microsoft SQL client (Microsoft.Data.SqlClient), so it accepts every keyword that client documents. Its strings start with Data Source=.

SQL authentication, the default database instance on the standard port:

Data Source=DBSERVER;Initial Catalog=Finance;User ID=%USERNAME%;Password=%PASSWORD%;

Windows (integrated) authentication. The connection runs as the Reportworq service account, so that account needs the database permissions; leave the two variable fields empty:

Data Source=DBSERVER;Initial Catalog=Finance;Integrated Security=True;

A named instance:

Data Source=DBSERVER\FINANCE;Initial Catalog=Finance;User ID=%USERNAME%;Password=%PASSWORD%;

An explicit port, which also avoids the SQL Server Browser service lookup a named instance otherwise needs:

Data Source=DBSERVER,1433;Initial Catalog=Finance;User ID=%USERNAME%;Password=%PASSWORD%;

A server that presents a self-signed or internally issued certificate. Use this on a private network only; the connection is still encrypted, but the server's identity is not verified:

Data Source=DBSERVER;Initial Catalog=Finance;User ID=%USERNAME%;Password=%PASSWORD%;TrustServerCertificate=True;

Azure SQL Database with a SQL login:

Data Source=tcp:<server>.database.windows.net,1433;Initial Catalog=<database>;User ID=%USERNAME%;Password=%PASSWORD%;Encrypt=True;

Azure SQL Database with a Microsoft Entra ID user. Put the user's sign-in address in %USERNAME% Variable and its password in %PASSWORD% Variable:

Data Source=tcp:<server>.database.windows.net,1433;Initial Catalog=<database>;Authentication=Active Directory Password;User ID=%USERNAME%;Password=%PASSWORD%;Encrypt=True;

Azure SQL Database with a Microsoft Entra ID service principal. Put the application (client) ID in %USERNAME% Variable and the client secret in %PASSWORD% Variable:

Data Source=tcp:<server>.database.windows.net,1433;Initial Catalog=<database>;Authentication=Active Directory Service Principal;User ID=%USERNAME%;Password=%PASSWORD%;Encrypt=True;

To change how long the connector waits for the connection to open, add Connection Timeout=60 (seconds) to the string; the SQL Server editor has no separate Connection Timeout field. The full keyword list is on Microsoft's SQL client connection-string reference, and the Entra ID options on Microsoft Entra authentication with the SQL client.

OleDB Provider#

The OleDB Provider connector passes the string to the OLE DB provider named in Provider=. That provider must be installed, in its 64-bit build, on the Windows server that runs Reportworq.

SQL Server through the Microsoft OLE DB Driver 18 for SQL Server, which registers as MSOLEDBSQL and does not encrypt by default:

Provider=MSOLEDBSQL;Data Source=DBSERVER;Initial Catalog=Finance;User ID=%USERNAME%;Password=%PASSWORD%;

SQL Server through the Microsoft OLE DB Driver 19, which installs side by side with 18 and registers as MSOLEDBSQL19. Version 19 encrypts by default, so add Trust Server Certificate=True when the server's certificate is not trusted, or Use Encryption for Data=Optional on a private network:

Provider=MSOLEDBSQL19;Data Source=DBSERVER;Initial Catalog=Finance;User ID=%USERNAME%;Password=%PASSWORD%;Trust Server Certificate=True;

The older Provider=SQLOLEDB and Provider=SQLNCLI11 providers are deprecated by Microsoft. Install the Microsoft OLE DB Driver for SQL Server and use MSOLEDBSQL or MSOLEDBSQL19 instead.

An Excel workbook through the Microsoft ACE provider. The path is on the Reportworq server, and HDR=YES treats the first row as column names; each worksheet then appears as a table named Sheet1$. This route is Windows-only; the dedicated Excel connector reads a workbook on Windows and Linux alike and also accepts a repository: path to a workbook shipped inside the repository:

Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Reportworq\data\Budget.xlsx;Extended Properties="Excel 12.0 Xml;HDR=YES";

An Access database through the same provider:

Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Reportworq\data\Finance.accdb;

A folder of delimited text files. Data Source is the folder, and each file is queried as a table, for example SELECT * FROM [sales.csv]. Read the result with =RWSQL so the report re-pulls the file on every run:

Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Reportworq\data\;Extended Properties="text;HDR=YES;FMT=Delimited";

The ACE provider ships with the 64-bit Microsoft Access Database Engine redistributable, which must be installed on the server. Depending on the installed version the provider registers as Microsoft.ACE.OLEDB.12.0 or Microsoft.ACE.OLEDB.16.0; use whichever name the server has.

ODBC Provider#

The ODBC Provider connector passes the string to the ODBC driver manager, which routes it to the driver named in Driver={...} or to the DSN named in DSN=. On Windows the driver name must match the Drivers tab of the 64-bit odbcad32.exe exactly; on Linux it must match the name registered in /etc/odbcinst.ini.

A 64-bit System DSN, the recommended form because the DSN can be tested in the operating system before Reportworq uses it:

DSN=FinanceWarehouse;Uid=%USERNAME%;Pwd=%PASSWORD%;

SQL Server through the Microsoft ODBC Driver 18. Version 18 encrypts by default, so include TrustServerCertificate=yes when the server's certificate is not trusted, or use Encrypt=no on a private network:

Driver={ODBC Driver 18 for SQL Server};Server=DBSERVER;Database=Finance;Uid=%USERNAME%;Pwd=%PASSWORD%;Encrypt=yes;TrustServerCertificate=yes;

PostgreSQL through the psqlODBC driver. On Windows the 64-bit driver registers as PostgreSQL Unicode(x64); on Linux it is usually PostgreSQL Unicode:

Driver={PostgreSQL Unicode(x64)};Server=dbhost;Port=5432;Database=finance;Uid=%USERNAME%;Pwd=%PASSWORD%;

MySQL through MySQL Connector/ODBC. The driver name carries the connector version, so match it to the installed driver:

Driver={MySQL ODBC 8.0 Unicode Driver};Server=dbhost;Port=3306;Database=finance;User=%USERNAME%;Password=%PASSWORD%;

Oracle Database through the Oracle ODBC driver installed with an Oracle client. The driver name is the Oracle home name, for example Oracle in OraClient19Home1. Set Validation Query to SELECT 1 FROM DUAL and Limit Query Type to Fetch First:

Driver={Oracle in OraClient19Home1};Dbq=//dbhost:1521/FINANCE;Uid=%USERNAME%;Pwd=%PASSWORD%;

IBM DB2 through the IBM Data Server Driver. Set Validation Query to SELECT 1 FROM SYSIBM.SYSDUMMY1 and Limit Query Type to Fetch First:

Driver={IBM DB2 ODBC DRIVER};Database=FINANCE;Hostname=dbhost;Port=50000;Protocol=TCPIP;Uid=%USERNAME%;Pwd=%PASSWORD%;

For Snowflake through its native ODBC driver, including the DSN and key-pair forms, see Connect Snowflake via ODBC.

More connection strings#

The examples above cover the common cases. For any other database, driver, or option, ConnectionStrings.com keeps a reference of connection strings for every major provider and driver, organized by database. The table below links straight to the pages that match the Reportworq connectors.

Database or source Reportworq connector Reference
SQL Server SQL Server (native), OleDB Provider, or ODBC Provider SQL Server connection strings, Microsoft.Data.SqlClient keywords, all SQL Server keywords
Azure SQL Database SQL Server (native) Azure SQL Database connection strings
SQL Server through OLE DB OleDB Provider Microsoft OLE DB Driver for SQL Server
SQL Server through ODBC ODBC Provider Microsoft ODBC Driver for SQL Server (the Driver 17 page; its keywords also apply to Driver 18)
Oracle ODBC Provider Oracle connection strings
MySQL and MariaDB ODBC Provider MySQL connection strings
PostgreSQL ODBC Provider PostgreSQL connection strings
IBM DB2 ODBC Provider IBM DB2 connection strings
Microsoft Access OleDB Provider Access connection strings
Excel workbook OleDB Provider Excel connection strings, ACE OLE DB provider
Text and CSV files OleDB Provider or ODBC Provider Text file connection strings
SQLite SQLite connector, or ODBC Provider SQLite connection strings, or Connect SQLite
Snowflake ODBC Provider, or the CData SnowFlake tile Connect Snowflake via ODBC, or Connect Snowflake

When you copy a string from a reference site, replace the literal username and password with %USERNAME% and %PASSWORD% before you paste it into Reportworq.

Windows and Linux servers#

Reportworq runs on Windows and on Linux, and the three connectors are not equally available on both. The table below shows what works where.

Connector Windows server Linux server
SQL Server Built in; nothing to install. Built in; nothing to install.
OleDB Provider Install the 64-bit OLE DB provider on the server. Not available. OLE DB is a Windows technology, and the connection fails with a platform-not-supported error. Use the SQL Server or ODBC Provider connector instead.
ODBC Provider Install the vendor's 64-bit ODBC driver. Create DSNs on the System DSN tab of the 64-bit odbcad32.exe. Install unixODBC and the vendor's Linux ODBC driver on the host. Drivers are registered in /etc/odbcinst.ini and System DSNs in /etc/odbc.ini.

On Linux, the way you install the ODBC driver depends on how Reportworq was deployed:

Windows (integrated) authentication works differently on the two platforms. On Windows the connection runs as the Reportworq service account, which must have permissions in the database. On Linux, integrated authentication needs a Kerberos configuration on the host, so prefer a SQL login or, for Azure SQL, Microsoft Entra ID authentication.

Advanced Options: timeouts and Limit Query Type#

The collapsible Advanced Options section exposes the timeouts:

Limit Query Type, in the main section of the editor, selects the row-limit clause the connector emits when a data model or preview caps the number of rows, and when a field import samples the first rows of a table. The native SQL Server connector applies the row cap with SET ROWCOUNT and ignores this setting; the table below applies to the OleDB Provider, ODBC Provider, and SQLite connectors. Choose the dialect of the database behind the connection:

Value Clause emitted Databases
Top (default) SELECT TOP n SQL Server through OLE DB or ODBC, Azure SQL, Access
Limit LIMIT n PostgreSQL, MySQL, MariaDB, SQLite
Fetch First FETCH FIRST n ROWS ONLY Oracle 12c and later, IBM DB2

The fourth value, Unavailable, is reserved. A connection set to it cannot import fields or preview, because every field import and preview applies a row cap and the connector has no clause to emit; the request fails with "Preview is unavailable because top/limit/fetch query is not supported". A wrong dialect fails with a syntax error the first time a row cap is applied, so set the value when you create the connection.

Query the source in a data model#

Once the connection tests, a model author builds views over it on the model's Connection tab, choosing a Query type:

Text variables in SQL need single quotes: a {{var}} is substituted as a raw text replace with no automatic quoting, so a value that must become a SQL string literal has to be wrapped, for example '{{state}}' resolving to 'Maine'. Numeric values are bare.

Report authors can also query the connection directly from a worksheet with =RWSQL; see Relational database functions.

Troubleshooting#

Find the symptom that matches what Test connection or a job reports, then read across to the cause and the fix.

Symptom Likely cause Fix
SQL Server: "The certificate chain was issued by an authority that is not trusted", or a certificate error mentioning the SSL provider The Microsoft SQL client encrypts by default and the server presents a self-signed or internally issued certificate that the Reportworq server does not trust. The ODBC Driver 18 for SQL Server and the OLE DB Driver 19 (Provider=MSOLEDBSQL19) behave the same way; OLE DB Driver 18 (Provider=MSOLEDBSQL) does not encrypt by default. Install a certificate from a trusted authority on the database server, or trust the issuing authority on the Reportworq server. On a private network you can instead trust the server's certificate (TrustServerCertificate=True for the SQL Server connector, TrustServerCertificate=yes for ODBC, Trust Server Certificate=True for OLE DB) or turn encryption off (Encrypt=False for the SQL Server connector, Encrypt=no for ODBC, Use Encryption for Data=Optional for OLE DB).
ODBC: "Data source name not found and no default driver specified" The Driver={...} name does not match an installed 64-bit driver, the DSN is a User DSN or a 32-bit DSN, or on Linux the driver is not registered in /etc/odbcinst.ini. Copy the name exactly from the Drivers tab of the 64-bit odbcad32.exe (or from odbcinst.ini), and create DSNs on the System DSN tab.
OLE DB: "Provider cannot be found. It may not be properly installed." The provider is not installed on the Reportworq server, only its 32-bit build is installed, or the server runs Linux. Install the 64-bit provider on the server. On Linux, use the SQL Server or ODBC Provider connector.
"Login failed for user", or an authentication error The login or password is wrong, a variable field is empty, the server allows Windows authentication only, or the Reportworq service account has no database access. Re-enter both variable fields, confirm the login exists on that database, and for integrated authentication grant the service account access.
"A network-related or instance-specific error occurred" The server name, instance, or port is wrong, the SQL Server Browser service is stopped so the named instance cannot be resolved, or a firewall blocks the port from the Reportworq server. Test the address from the Reportworq server itself, and prefer Data Source=SERVER,port to avoid the Browser lookup.
"Execution Timeout Expired", or a job fails on a query that works in a database tool The query runs longer than Command Timeout (30 seconds by default). Raise Command Timeout in Advanced Options, or set it to 0 to wait indefinitely. On ODBC, a slow connection open is bounded by Connection Timeout instead.
A long SQL query in one Excel cell silently returns nothing The query is longer than one Excel cell allows, or a fragment cell does not start with =. Split the query across several cells and concatenate them in the =RWSQL argument, for example =$A$1&$A$2&$A$3. Every fragment cell that is a formula must start with =, otherwise its leading quote is embedded literally into the string. Validate the reassembled SQL in a database tool, and watch for missing table aliases once the fragments are joined.
The connection tests but a row-limited preview fails with a syntax error Limit Query Type does not match the database's dialect. Set it to Top, Limit, or Fetch First as described above.

Going deeper. To curate columns into governed business fields, set filters, and publish a view for report authors, see Data models.

Feedback on this page

Comments, questions, requests, or something missing or unclear? Email us - the page you are on is filled in for you.

Email feedback on this page

Or write to support@reportworq.com directly.