Skip to main content

Troubleshooting Database Integrations

If you encounter errors connecting database integrations (Postgres, MySQL, MariaDB, MongoDB, SQL Server) from Superblocks, check the following conditions / scenarios:

Correct settings for:

  • Host/IP address - Results in a getaddrinfo ENOTFOUND error when the hostname is incorrect.
  • Database name - Specify the database name, not the database instance identifier. Otherwise, Superblocks will report an Unknown database error.
  • Username and Password - Invalid credentials result in Access denied or password authentication failed for user errors.

Inbound access blocked

Is there a firewall blocking access to the database? For example, if you're using Superblocks Cloud, make sure your VPC security groups have the right inbound rules to allow access from the Superblocks IP addresses. Similarly, if you're running the On-premise Agent, make sure that it is running inside the same network as the database or is allowed to connect to your database externally. Expect to see Connection timeout: failed to create socket, timeout expired, or similar errors when the database instance is not accessible from Superblocks.

Server listening internally only

If you're running your own database server, you may need to configure it to accept remote connections, instead of listening locally on its network interfaces. If the latter is true, then you can configure the server to listen on all interfaces by editing the database config file and setting the bind / listening address accordingly (for example bind_address = 0.0.0.0 for MySQL or listen_addresses = '*' for Postgres).

Testing with On-premise Agent using localhost

For Docker containers, localhost inside a container doesn't mean the same from the context of the host where the container is running. As such, you'll see ECONNREFUSED errors if you've specified localhost in the integration form. Instead, use host.docker.internal in the Superblocks integration form configuration. More on this in the Docker docs here.

Working with Parameterized SQL Statements

Parameterized SQL Statements are enabled by default for all SQL databases to protect against SQL injection. When enabled, you do not need to insert quotes around data bindings passed to SQL parameters and using quotes will cause the query to fail. Parameterized SQL Statements can be enabled/disabled on the individual database API step.

For example, the correct syntax to write a SQL query to select all orders that match a name provided in an Input component is:

SELECT * FROM orders WHERE product={{Input1.value}};

If Parameterized SQL Statements are disabled for an API step, then the correct syntax would be:

SELECT * FROM orders WHERE product='{{Input1.value}}';

If you continue having any issues connecting to your database, contact help@superblockshq.com and our support team will assist promptly.