How-to

How to connect a SQL database to Hubviz

Connect SQL Server, PostgreSQL, MySQL, Oracle, Firebird, SAP HANA or ODBC to Hubviz Studio, test the authentication and build a cube from a SQL query.

Connect your company database and build a cube from a SQL query. The steps are the same for every database. Only the type and the port change.

When to use it

  • Your data already lives in a system with a SQL database, such as an ERP, an in-house CRM or a BI database.
  • You want the cube to refresh by itself, without exporting spreadsheets.
  • You need to join tables, filter the period or compute columns before the data reaches Hubviz.

If your data is in a spreadsheet, use Excel and CSV or Google Sheets.

Before you start

  • Have the server address (host), the port, the database name, a user and the password at hand.
  • Prefer a read-only user. Hubviz only queries the data.
  • In the installed Hubviz Studio, the connection leaves from your computer. If you reach the database through the company network or the VPN, Hubviz reaches it too.
  • In the browser, the connection leaves from the Hubviz servers. The database must accept connections from the internet.

Create the connection

  1. In the project side menu, open Cubes and click the + button.

  2. Click Create Manually, pick the Database type and click Next.

  3. Click Create New Connection. The new connection window opens.

  4. Fill in Connection Name. It is just a nickname to find the connection later. It does not change the connection.

  5. Open Database Type and pick the database. Its default port is filled in for you.

  6. Fill in Host, Database Name, Username and Password. Change the Port only if your server uses another one.

  7. Click Test Authentication. If everything is right, you see the message Connection successful!.

  8. Choose where to keep the connection in Storage and click Save. See the difference between Local and Cloud below.

Connection fields

FieldRequiredWhat it does
Connection NameYesNickname of the connection. Shown in the connection list and in the cubes.
Database TypeYesThe database: SQL Server, PostgreSQL, MySQL, OracleDB, Firebird or SAP HANA. ODBC shows up only when it is turned on (see ODBC).
Database NameNoThe database inside the server, such as erp_aurora. Left blank, the user’s default database is used.
HostYesServer name or IP, without http://. Examples: sql.aurora.local, 10.0.0.15.
PortYesFilled in with the default port of the database. If you change the database and did not touch the port, it changes too.
UsernameYesDatabase user.
PasswordYesThe user’s password. The eye icon shows what you typed. Once saved, the password is stored encrypted.
Encrypt ConnectionNoSQL Server only. Checked by default. Uncheck it only if the server does not accept encrypted connections.

Default ports

DatabaseDefault portNote
SQL Server1433Has the Encrypt Connection option, on by default
PostgreSQL5432
MySQL3306
OracleDB1521
Firebird3050
SAP HANA30015Needs the SAP HANA Client installed. Hubviz warns you in the window itself
ODBCSet in the DSNSee ODBC

Local or Cloud

At the top of the window, Storage sets where the connection is kept.

OptionWhere it livesWhen to use it
LocalOn this computer only. Default for new connections.A database on the internal network that only this computer reaches.
CloudIn your Hubviz account.So other people on the team can use the same connection, and to refresh the cube from the cloud.

With Cloud selected, a button with a people icon shows up. It opens Profile access, where you choose in Users with access who can see and use the connection. You are always included.

Create the cube

  1. With the connection selected, write or paste the SQL query in the text field. If you leave it blank, the cube starts with a commented template, such as -- SELECT TOP 100 * FROM Tabela; on SQL Server, and you write the query later.
  2. Click Next.
  3. Name the cube in Cube Name and click Finish. Hubviz runs the query once to find the columns.

The cube opens on the Query Editor tab, with the database tables next to the editor.

  • To run the query, click the lightning button (Execute Query) or press F5.
  • Don’t know SQL? Click the stars button (Generate SQL with AI), pick the tables and describe what you need. See SQL with AI.

After the first run that returns rows, the Field Mapping tab becomes available to review the fields. See Cube fields.

Example: Aurora’s ERP sales

Aurora keeps its sales in a SQL Server on the internal network. The connection uses these (fictional) values:

FieldValue
Connection NameAurora ERP (SQL Server)
Database TypeSQL Server
Hostsql.aurora.local
Port1433
Database Nameerp_aurora
Usernamebi_readonly
StorageLocal, because the server only exists on the company network

The query of the Sales cube returns one row per date and business unit, with the column names the charts will use:

SELECT
    CAST(v.data_venda AS date) AS data,
    u.nome                     AS unidade,
    SUM(v.valor_total)         AS receita,
    SUM(v.custo_total)         AS custo,
    MAX(m.valor_meta)          AS meta
FROM vendas v
JOIN unidades u ON u.id = v.unidade_id
LEFT JOIN metas m ON m.unidade_id = u.id AND m.mes = DATEFROMPARTS(YEAR(v.data_venda), MONTH(v.data_venda), 1)
WHERE v.data_venda >= '2026-01-01'
GROUP BY CAST(v.data_venda AS date), u.nome

Then, in the cube, the calculated field lucro_bruto = receita - custo completes the model. See Calculated fields.

ODBC

ODBC covers databases that are not on the list, as long as there is an ODBC driver and a configured DSN.

  1. In the top menu, open Data Sources and turn on Include ODBC Configurations. The ODBC option now appears in Database Type.
  2. Create the connection as above and pick ODBC.
  3. Enter the DSN. The field depends on where Hubviz runs (table below).
  4. Username and Password are optional. Leave them blank to use the ones in the DSN.
WhereFieldWhat to enter
Installed Hubviz StudioSelect ODBC DSNPick a DSN from the list. It shows the DSNs on this computer with their architecture (32 or 64 bit). If the list is empty, you see No ODBC DSN found.
BrowserODBC DSN nameThe name of the DSN configured on the server that runs the Hubviz API, not on your computer.
BrowserODBC connection string (optional)Optional. When filled in, it replaces the DSN name and the user fields.

A database whose ODBC driver exists only on your computer works through the installed Hubviz Studio.

Common errors

MessageWhat to do
Verify if all required information has been filled in.When testing: the connection name, host, port or user is missing.
Please fill in all fields before submitting the form.When saving: the database type, host, port or user is missing. For ODBC, the DSN is missing.
Select an ODBC DSNWhen testing an ODBC connection without a DSN. Pick a DSN.
A message from the database itself, such as a login failure or server not foundHubviz shows the error the database returned. Check user, password, host and port, and whether the database accepts connections from the right origin (your computer or the internet).

Good to know

  • Changed the database password? Edit the connection once. Every cube that uses it switches to the new password.
  • Columns with the same name in the query cause an error. Use aliases, such as SELECT c.name AS customer, s.name AS seller.
  • For the cube to refresh by itself, see Automatic refresh. A database that only exists on the internal network refreshes through the schedule on this computer, not through the cloud.