连接到 PostgreSQL

动词:postgreConnect

可从以下位置获取: <Standard>

连接到 PostgreSQL 数据库。

语法

postgreConnect --connectionstring(String) (DbConnection)=connection

输入

脚本 设计器 必需的 AcceptedTypes Description
--connectionstring 连接字符串 必需的 文本 用于连接到 PostgreSQL 数据库的连接字符串
为了能够连接到具有输入的连接字符串的 PostgreSQL 数据库,必须先前配置此数据库。

输出

脚本 设计器 AcceptedTypes Description
connection 连接 数据库连接 从与 PostgreSQL 数据库的连接返回数据。

示例

此示例连接到 PostgreSQL 数据库,然后使用断言条件命令验证连接是否成功。 如果连接为空,那么将显示消息“Could not connect to the Database!” 。

defVar --name dbConnection --type DbConnection
// Connect to the database via the connection string and store the data in the connection variable.
postgreConnect --connectionstring "User ID=root;Password=myPassword;Host=localhost;Port=5432;Database=myDataBase;\r\nPooling=true;Min Pool Size=0;Max Pool Size=100;Connection Lifetime=0;" dbConnection=connection
// Check if the connection was successful
assert --message "Could not connect to the Database!" --left "${dbConnection}" --operator "Is_Null" --negate

另请参阅

  • 连接到 MySQL
  • 连接到 ODBC
  • 连接到 Oracle
  • 连接到 SQL Server
  • 连接到 SQLite