Connect
Establishes a connection to a PostgreSQL database.
Common Properties
- Name - The custom name of the node.
- Color - The custom color of the node.
- Delay Before (sec) - Waits in seconds before executing the node.
- Delay After (sec) - Waits in seconds after executing node.
- Continue On Error - Automation will continue regardless of any error. The default value is false.
info
If the ContinueOnError property is true, no error is caught when the project is executed, even if a Catch node is used.
Inputs
- Host - The hostname or IP address of the PostgreSQL server.
- Port - The port number on which the PostgreSQL server is listening.
- Database - The name of the database to connect to.
- Parameters - Additional connection parameters as a semicolon-separated string.
- Credentials - The username and password credentials for authenticating with the database.
Options
- None
Output
- Connection Id - A unique identifier for the established database connection.
How It Works
The Connect node establishes a connection to a PostgreSQL database using the provided connection parameters. When executed, the node:
- Validates the provided connection parameters
- Constructs a connection string from the provided parameters
- Creates and opens a new NpgsqlConnection
- Generates a unique connection ID
- Stores the connection in an internal connections dictionary
- Returns the connection ID as output
Requirements
- Valid PostgreSQL server hostname/IP address
- Valid port number (typically 5432)
- Valid database name
- Valid username and password credentials
Error Handling
The node will return specific errors in the following cases:
- Empty or invalid connection string
- Failed to add connection due to a duplicate GUID
Usage Notes
- The connection ID should be stored and used in subsequent database operations
- Connections should be properly closed using the Disconnect node when no longer needed
- The connection parameters should match the PostgreSQL server configuration
- The Credentials option should be configured with valid database authentication credentials