SQL-DB Client Connect

This function block is used to configure and establish a connection to a SQL database (MySQL, PostgreSQL, MSSQL, SQLite). Use it to create a persistent database client that other blocks can use to run queries or perform data operations.

πŸ“₯ Inputs

This function block does not have input sockets.

πŸ“€ Outputs

DB Client A reusable database client object that other blocks (for example SQL-DB Operations) can use to execute queries and transactions.

Connection Success A boolean indicating whether the connection was established successfully.

πŸ•ΉοΈ Controls

Database Type A dropdown to choose the kind of database (MySQL, PostgreSQL, MSSQL, SQLite). Choosing SQLite will simplify the UI because no host/port/user/password are required.

Host Hostname or IP address of the database server. Hidden for SQLite.

Database Database name. For SQLite this field is used as the database file path.

Port TCP port of the database server. Hidden for SQLite.

User Database username. Hidden for SQLite.

Password Database password. Hidden for SQLite.

Note: Changing any of these fields will reset the existing connection and trigger a new connection attempt when the block is evaluated.

🎯 Features

  • Simple multi-database support with a single, unified UI for common SQL backends.

  • SQLite compatibility with reduced fields when a file-based database is selected.

  • Outputs a ready-to-use DB Client and a Connection Success flag for downstream logic and error handling.

  • Automatic reconnection when configuration changes are detected.

πŸ“ Usage Instructions

  1. Select Database Type that matches your server.

  2. Fill in Host, Port, User, Password, and Database as appropriate (for SQLite provide the file path in Database).

  3. Run your scenario or evaluate the block. The block will attempt to connect and will set Connection Success accordingly.

  4. Use the provided DB Client with SQL-DB Operations to perform queries, inserts, updates, or other database tasks.

  5. If you change any connection fields, the block will reset the current connection and attempt to reconnect on next evaluation.

πŸ“Š Evaluation

When evaluated, the block validates the provided parameters and attempts to establish a connection. On success it exposes a reusable client via the DB Client output and sets Connection Success to true. On failure it logs an error and sets Connection Success to false.

πŸ’‘ Tips and Tricks

  • Combine with SQL-DB Operations to run queries and return results into the flow.

  • Use Data to JSON to serialize complex results before writing them to files or sending them over a network.

  • Use CSV Export or Image Logger (for image-related metadata) to persist results coming from database queries.

  • Use Data Write Local or Data Write Global to store the DB Client or recent query results for reuse across different parts of your project.

  • Use Debug Input to inspect raw outputs from SQL-DB Operations while building and troubleshooting your scenario.

πŸ› οΈ Troubleshooting

  • Connection fails but credentials are correct: verify network access to Host and that the selected Port is open and accepting connections.

  • Using SQLite: ensure the path provided in Database is accessible and the application has file permissions to read/write that file.

  • If configuration changes appear not to take effect: edit any control (for example Host) to force the block to reset and re-establish the connection.

  • If you need to confirm returned data while developing, attach SQL-DB Operations and Debug Input to inspect responses before integrating them further.

Last updated

Was this helpful?